Canovice
Canovice

Reputation: 10471

Upgrade R version from 3.4.4 to 3.5.3 on Ubuntu 16.04

When we ssh onto this Linux server, it says Welcome to Ubuntu 16.04.7 LTS (GNU/Linux 4.4.0-193-generic x86_64), so this is the type of server we are on.

When we run R to launch R in the server from terminal, and then version, we get:

enter image description here

What is the easiest way to upgrade from version 3.4.4 to version 3.5.3? We don't want to upgrade to v4 or to the latest version quite yet until we ensure no breaking issues with our codebase on R v4, however we would like to make this upgrade to 3.5.3 so we can run an R library that requires 3.5.3+.

How can we do this from the command line on the server here, and after switching from 3.4.4 to 3.5.3 do we then need to re-install all R libraries on the server as well? I'm worried if I start running stuff from the command line and I mess up that I'll break our current R app.

Upvotes: 2

Views: 987

Answers (1)

Ben Bolker
Ben Bolker

Reputation: 226761

I would be surprised if there is a .deb available for this OS release/R release combination.

  • This page only offers R 4.1, but as far back as 16.04 LTS
  • This page offers older R versions, but only back to 18.04 LTS
  • It's also possible that one of the backports on the Debian packages page would work on your system (it reports that 3.5.3 is available for Debian "jessie", although I have no idea how that lines up with Ubuntu releases).

I guess it's possible that one of those .debs works for your system though ... ? If you do install from .deb, you may have to be careful not to clobber your current version (e.g. using the --instdir argument to dpkg).

Building from source:

  • download the source tarball for R 3.5.3
  • untar, ./configure, make, sudo make install (assuming you have all the necessary development tools, system libraries, etc.; you'll have to troubleshoot/install as you go along)
    • It might be worth ./configure --prefix=/path/to/testdir to put the new version in a completely separate location, just to make extra-sure you don't stomp on your current install. (This would also simplify the library-path stuff below.)

Packages do need to be re-installed when switching major versions (e.g. 3.4.x to 3.5.x); one way to do it is to copy the system library of packages to a new place (adjust library paths as necessary; see R installation and administration manual).

Then, you should be able to update.packages(checkBuilt=TRUE, ask=FALSE) to update everything.

The tricky spots are (1) getting the library paths right (this will depend a bit on how things are set up in your existing installation; (2) it's conceivable that some current versions of packages on CRAN will fail to re-install/re-build under R 3.5.3. devtools::install_version() would help, although you'd have to track down the correct version manually. I recall someone posting about a package that would install an archived version by date, which could save a lot of poking around ...

Upvotes: 3

Related Questions