Error when installing RStan on Ubuntu 20.04

I am trying to install RStan on Ubuntu 20.04 but when I do

sudo add-apt-repository -y "ppa:marutter/rrutter3.5"

I get this error:

E: The repository 'http://ppa.launchpad.net/marutter/c2d4u3.5/ubuntu focal Release' does not have a Release file.

It looks like the 3.5 ppa does not provide packages for Focal, the most recent is Bionic. You should use the 4.0 ppa instead:

sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0+

I’ll update the wiki instructions to point to this.

1 Like

I tried with it but I got this error:
E: The repository 'http://ppa.launchpad.net/marutter/c2d4u3.5/ubuntu focal Release' does not have a Release file.

Are you sure you’re running what I posted above? The error message implies that you’re still running the command for the 3.5 ppa?

Try removing the old ppa first:

sudo add-apt-repository --remove ppa:marutter/rrutter3.5
sudo add-apt-repository --remove ppa:marutter/c2d4u3.5

Thank You. Now it works. But in the instructions that I am Following there are two commands:

sudo add-apt-repository -y "ppa:marutter/rrutter3.5"
sudo add-apt-repository -y "ppa:marutter/c2d4u3.5"

It’s not entirely necessary if you already have R installed, but the command is:

sudo add-apt-repository ppa:marutter/rrutter4.0

  • Provides base R and its packages (e.g., boot, cluster)

sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0+

  • Provides R packages (e.g., rstan)
1 Like

Thank you. I think it’s solved. It passed the tests and I could open the library in RStudio.

please, I’m trying to install this for Ubuntu 21.04 but there is no PPA release file for c2d4u. will appreciate if you can help.

Can you remove any old configs:

sudo add-apt-repository --remove ppa:marutter/rrutter3.5
sudo add-apt-repository --remove ppa:marutter/c2d4u3.5

Then add the repositories for R4.0:

sudo add-apt-repository ppa:marutter/rrutter4.0
sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0+

Then try again?

1 Like

yeah… tried this already, it only accepted the marutter PPA but the c2d4u required me adding it to repository list manually.

now, the issue I’m getting is while installing rstan with

sudo apt install r-cran-rstan

i get this error: r-cran-v8 : Depends: libnode64 but it is not installable

even thought linux already has a v8 engine by default.

There are two options here. First you can try running:

sudo apt install libnode-dev

Then try the install again.

If that doesn’t work, you can install V8 through R via:

Sys.setenv(DOWNLOAD_STATIC_LIBV8 = 1)
install.packages("V8")

Then try the rstan install again

1 Like

thanks… after trying this, i tried installing rstan in R itself but it keeps on resulting in errors

** libs
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-kbcSEe/r-base-4.1.1=. -flto=auto -ffat-lto-objects -fstack-protector-strong  -c AMD/Source/amd.f -o AMD/Source/amd.o
/bin/bash: line 1: gfortran: command not found
make: *** [/usr/lib/R/etc/Makeconf:191: AMD/Source/amd.o] Error 127
ERROR: compilation failed for package ‘igraph’
* removing ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1/igraph’
Warning in install.packages :
  installation of package ‘igraph’ had non-zero exit status
ERROR: failed to lock directory ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1’ for modifying
Try removing ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-RcppEigen’
Warning in install.packages :
  installation of package ‘RcppEigen’ had non-zero exit status
ERROR: dependency ‘igraph’ is not available for package ‘threejs’
* removing ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1/threejs’
Warning in install.packages :
  installation of package ‘threejs’ had non-zero exit status
ERROR: dependency ‘RcppEigen’ is not available for package ‘StanHeaders’
* removing ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders’
Warning in install.packages :
  installation of package ‘StanHeaders’ had non-zero exit status
ERROR: dependencies ‘StanHeaders’, ‘RcppEigen’ are not available for package ‘rstan’
* removing ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1/rstan’
Warning in install.packages :
  installation of package ‘rstan’ had non-zero exit status
ERROR: dependencies ‘rstan’, ‘threejs’ are not available for package ‘shinystan’
* removing ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1/shinystan’
Warning in install.packages :
  installation of package ‘shinystan’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpS1siec/downloaded_packages’

You need to have the build tools installed for R to be able to build and install packages, try running:

sudo apt install build-essential

returned this

build-essential is already the newest version (12.8ubuntu3).
build-essential set to manually installed.
The following package was automatically installed and is no longer required:
  g++-10

What about:

sudo apt install gfortran

?

it’s installing now… do i try to install Rstan again after this?

Just try the V8 install first:

Sys.setenv(DOWNLOAD_STATIC_LIBV8 = 1)
install.packages("V8")

Then the rstan install, either through the ppa or R

didn’t see this. but i just tried installing and it returned this error

/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: igraph.so] Error 1
ERROR: compilation failed for package ‘igraph’
* removing ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1/igraph’
Warning in install.packages :
  installation of package ‘igraph’ had non-zero exit status
ERROR: failed to lock directory ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1’ for modifying
Try removing ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-RcppEigen’
Warning in install.packages :
  installation of package ‘RcppEigen’ had non-zero exit status
ERROR: dependency ‘igraph’ is not available for package ‘threejs’
* removing ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1/threejs’
Warning in install.packages :
  installation of package ‘threejs’ had non-zero exit status
ERROR: dependency ‘RcppEigen’ is not available for package ‘StanHeaders’
* removing ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders’
Warning in install.packages :
  installation of package ‘StanHeaders’ had non-zero exit status
ERROR: dependencies ‘StanHeaders’, ‘RcppEigen’ are not available for package ‘rstan’
* removing ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1/rstan’
Warning in install.packages :
  installation of package ‘rstan’ had non-zero exit status
ERROR: dependencies ‘rstan’, ‘threejs’ are not available for package ‘shinystan’
* removing ‘/home/shorpee/R/x86_64-pc-linux-gnu-library/4.1/shinystan’
Warning in install.packages :
  installation of package ‘shinystan’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/Rtmp7sj73n/downloaded_packages’

These indicate system dependencies that are needed for some of the R packages:

/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas

Can you try installing rstan through the ppa, as I believe it should install these automatically