Difficulty building different version of R from source in Rstudio Pro Server

I'm attempting to install multiple versions of R on my Rstudio Pro Server. I have 3.5.3 and 3.6.1 installed and I'd like to build 3.6.2 from source.

I used the following code first:

# Install Linux dependencies  
apt-get build-dep r-base

I got the error message:

Reading package lists... Done

E: You must put some 'source' URIs in your sources.list

To fix this, I went into the /etc/apt/sources.list file on my server and uncommented the line

deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted

When I ran the code to update the Linux dependencies again I got a different error: E: Unable to find a source package for r-base

The rest of my code is below:

# Download and extract source code 

$ wget https://cran.r-project.org/src/base/R-3/R-3.6.2.tar.gz

$ tar -xzvf R-3.6.2.tar.gz 

$ cd R-3.6.2 

# Build R from source 

$ ./configure --prefix=/opt/R/3.6.2 --enable-R-shlib --with-blas --with-lapack 

$ make 

make: *** No targets specified and no makefile found.  Stop.

$ sudo make install

*** No rule to make target 'install'.  Stop.

So obviously this didn't work because its unable to find the source packaging. When I look into the R-3.6.2 directory I see the following files:

drwxr-xr-x 10 ubuntu ubuntu 4096 May 18 20:08 .

drwxr-xr-x 9 ubuntu ubuntu 4096 May 18 19:49 ..

-rw-r--r-- 1 ubuntu ubuntu 18011 Sep 25 2018 COPYING

-rw-r--r-- 1 ubuntu ubuntu 210 Sep 25 2018 ChangeLog

-rw-r--r-- 1 ubuntu ubuntu 1759 Sep 25 2018 INSTALL

-rw-r--r-- 1 ubuntu ubuntu 5050 Mar 28 2019 Makeconf.in

-rw-r--r-- 1 ubuntu ubuntu 7204 Sep 25 2018 Makefile.fw

-rw-r--r-- 1 ubuntu ubuntu 7903 Dec 4 2018 Makefile.in

-rw-r--r-- 1 ubuntu ubuntu 4132 Sep 25 2018 README

-rw-r--r-- 1 ubuntu ubuntu 46 Dec 12 08:00 SVN-REVISION

-rw-r--r-- 1 ubuntu ubuntu 6 Dec 12 08:00 VERSION

-rw-r--r-- 1 ubuntu ubuntu 22 Dec 1 23:02 VERSION-NICK

-rw-rw-r-- 1 ubuntu ubuntu 77565 May 18 20:08 config.log

-rw-r--r-- 1 ubuntu ubuntu 13836 Sep 2 2019 config.site

-rwxr-xr-x 1 ubuntu ubuntu 1482144 Dec 4 23:16 configure

-rw-r--r-- 1 ubuntu ubuntu 94251 Sep 11 2019 configure.ac

drwxr-xr-x 4 ubuntu ubuntu 4096 May 18 19:49 doc

drwxr-xr-x 2 ubuntu ubuntu 4096 May 18 19:49 etc

drwxr-xr-x 2 ubuntu ubuntu 4096 May 18 19:49 m4

drwxr-xr-x 2 ubuntu ubuntu 4096 May 18 19:49 po

drwxr-xr-x 11 ubuntu ubuntu 4096 May 18 19:49 share

drwxr-xr-x 12 ubuntu ubuntu 4096 Dec 12 08:04 src

drwxr-xr-x 5 ubuntu ubuntu 4096 May 18 19:49 tests

drwxr-xr-x 2 ubuntu ubuntu 4096 May 18 19:49 tools

Any advice on how to make this work? Thanks so much!!

Any particular reason why you want to compile from source? Using our R binaries is typically easier.

Anyway, you have enabled deb-src for bionic-security, but that is not where r-base is found. You will at least need to un-comment

deb-src http://archive.ubuntu.com/ubuntu/ bionic universe

With that

sudo apt-get update
sudo apt-get build-dep r-base

should succeed and you should be able to build R from source.

BTW, the make error you quoted is odd. What was the output of your configure call?

I had read in the Rstudio server admin that compiling from source is the best way to use multiple versions of R - https://docs.rstudio.com/ide/server-pro/r-versions.html

I was able to get it working by including deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ in the sources.list file and then running:

sudo apt-get update
# this gives me a pub key
W: GPG error: https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY <KEY>

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key <KEY>

sudo apt-get update
sudo apt-get install r-base

Output of configure call seemed all good, its too long to post here but it was a bunch of checking lines and then creating files which configured R.

Interestingly, this also somehow downloaded 3.6.3 onto my machine as well and now some of my packages won't build. But a new day, a new error message!

The documentation for Server Pro is a bit out of date here. Our current recommendation is to install multiple versions of R. The easiest way is to use the binaries we a re providing. If you have special requirements, you can also compile from source. Installing R from the distribution's repository or from the backports on CRAN as you have done now is not recommended in conjunction with our Pro products, since for these the version might change breaking reproducibility.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.