Score:1

Is it possible to prevent R package conflicts while upgrading Ubuntu 16.04 LTS with R from CRAN to Ubuntu 18.04 LTS?

zw flag

I have fully updated Ubuntu 16.04.7 LTS amd64 which was configured for RMarkdown/bookdown, LaTeX publishing using the following commands:

sudo apt-get install apt-transport-https

cat <<EOF | sudo tee /etc/apt/sources.list.d/r-cran.list
deb https://cloud.r-project.org/bin/linux/ubuntu xenial/
EOF
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

sudo apt-get update

sudo apt-get install -y r-base-dev libssl-dev libjpeg62 libgstreamer0.10-0 libgstreamer-plugins-base0.10-0 calibre
sudo apt-get install -y biber texlive-lang-cyrillic fonts-cmu texlive-xetex texlive-fonts-extra texlive-math-extra font-manager ttf-mscorefonts-installer lmodern
sudo apt-get install -y build-essential libcurl4-openssl-dev libxml2-dev libcairo2-dev git

wget https://github.com/jgm/pandoc/releases/download/2.11.4/pandoc-2.11.4-1-amd64.deb -O /tmp/pandoc.deb
sudo apt-get install -y /tmp/pandoc.deb

wget -c https://download1.rstudio.org/desktop/xenial/amd64/rstudio-1.4.1106-amd64.deb -O /tmp/rstudio.deb
sudo apt-get install -y /tmp/rstudio.deb

mkdir -p ~/R/x86_64-pc-linux-gnu-library/3.4
R -e "install.packages(c('bookdown','tikzDevice','xaringan'), repos='http://cran.rstudio.com/', lib='/home/$USER/R/x86_64-pc-linux-gnu-library/3.4')"

This means that its /etc/apt/sources.list /etc/apt/sources.list.d/*.list contains the following lines:

$ grep ^deb -r /etc/apt/ --include=*.list
/etc/apt/sources.list.d/r-cran.list:deb https://cloud.r-project.org/bin/linux/ubuntu xenial/
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu/ xenial main restricted
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu/ xenial universe
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu/ xenial-updates universe
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu/ xenial multiverse
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu/ xenial-updates multiverse
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu xenial-security main restricted
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu xenial-security universe
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu xenial-security multiverse

and this system has the following set of R packages:

$ dpkg -l | grep "^ii  r-"
ii  r-base                                3.4.4-1xenial0                                  all          GNU R statistical computation and graphics system
ii  r-base-core                           3.4.4-1xenial0                                  amd64        GNU R core of statistical computation and graphics system
ii  r-base-dev                            3.4.4-1xenial0                                  all          GNU R installation of auxiliary GNU R packages
ii  r-base-html                           3.4.4-1xenial0                                  all          GNU R html docs for statistical computing system functions
ii  r-cran-boot                           1.3-20-1xenial0                                 all          GNU R package for bootstrapping functions from Davison and Hinkley
ii  r-cran-class                          7.3-14-2xenial0                                 amd64        GNU R package for classification
ii  r-cran-cluster                        2.0.7-1-1xenial0                                amd64        GNU R package for cluster analysis by Rousseeuw et al
ii  r-cran-codetools                      0.2-15-1cran1xenial0                            all          GNU R package "Code Analysis Tools for R"
ii  r-cran-foreign                        0.8.70-1xenial0                                 amd64        GNU R package to read/write data from other stat. systems
ii  r-cran-kernsmooth                     2.23-15-3xenial0                                amd64        GNU R package for kernel smoothing and density estimation
ii  r-cran-lattice                        0.20-38-1cran1xenial0                           amd64        GNU R package "Trellis Graphics for R"
ii  r-cran-mass                           7.3-50-1xenial0                                 amd64        GNU R package of Venables and Ripley's MASS
ii  r-cran-matrix                         1.2-14-1xenial0                                 amd64        GNU R package of classes for dense and sparse matrices
ii  r-cran-mgcv                           1.8-28-1cran1xenial0                            amd64        GNU R package "Mixed GAM Computation Vehicle with
ii  r-cran-nlme                           3.1.137-1xenial0                                amd64        GNU R package for (non-)linear mixed effects models
ii  r-cran-nnet                           7.3-12-2xenial0                                 amd64        GNU R package for feed-forward neural networks
ii  r-cran-rpart                          4.1-15-1cran1xenial0                            amd64        GNU R package "Recursive Partitioning and Regression
ii  r-cran-spatial                        7.3-11-1xenial0                                 amd64        GNU R package for spatial statistics
ii  r-cran-survival                       2.44-1.1-1cran1xenial0                          amd64        GNU R package "Survival Analysis"
ii  r-doc-html                            3.4.4-1xenial0                                  all          GNU R html manuals for statistical computing system
ii  r-recommended                         3.4.4-1xenial0                                  all          GNU R collection of recommended packages [metapackage]

From previous experience I know that some of R packages are newer than versions from Ubuntu 18.04.6 LTS official repository.

How should I upgrade this Ubuntu 16.04.7 LTS to Ubuntu 18.04.6 LTS correctly in this situation?

Score:1
zw flag

To run upgrade process from Ubuntu 16.04.7 LTS with R 3.4 from CRAN flawlessly one should do the following:

  1. Backup a list of installed R packages

    dpkg -l | grep "^ii  r-" | awk '{print $2}' > ~/r-debs.txt
    
  2. Remove CRAN r-cran.list APT sources file by

    sudo rm /etc/apt/sources.list.d/r-cran.list
    
  3. Remove R packages

    sudo apt-get autoremove $(cat r-debs.txt) --purge
    
  4. Install R packages back using versions from official repositories

    sudo apt-get install $(cat r-debs.txt)
    
  5. Install possible updates

    sudo apt-get update
    sudo apt-get dist-upgrade
    

    then reboot.

  6. Upgrade Ubuntu as usual using sudo do-release-upgrade or update-manager -c .

  7. Upgrade RStudio using command below:

    wget -c https://download1.rstudio.org/desktop/bionic/amd64/rstudio-1.4.1717-amd64.deb -O /tmp/rstudio.deb
    sudo apt-get install -y /tmp/rstudio.deb
    

The resulting Ubuntu 18.04.6 LTS system will have fully-functional R 3.4 from official repository.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.