skip to Main Content

I am trying to run an MCMC model on a cluster computing platform but cannot install rstan.

The error I get is this:

 Installing package into ‘/home/lixx5010/.libraries/R/3.6/library’
    (as ‘lib’ is unspecified)
    also installing the dependency ‘V8’
    
    trying URL 'https://cran.rstudio.com/src/contrib/V8_3.4.2.tar.gz'
    Content type 'application/x-gzip' length 801493 bytes (782 KB)
    ==================================================
    downloaded 782 KB
    
    trying URL 'https://cran.rstudio.com/src/contrib/rstan_2.21.2.tar.gz'
    Content type 'application/x-gzip' length 1152008 bytes (1.1 MB)
    ==================================================
    downloaded 1.1 MB
    
    * installing *source* package ‘V8’ ...
    ** package ‘V8’ successfully unpacked and MD5 sums checked
    ** using staged installation
    Not using CXX14
    Using CXXCPP=g++ -std=gnu++11 -E
    Using PKG_CFLAGS=-I/usr/include/v8 -I/usr/include/v8-3.14
    Using PKG_LIBS=-lv8 -lv8_libplatform
    -----------------------------[ ANTICONF ]-------------------------------
    Configuration failed to find the libv8 engine library. Try installing:
     * deb: libv8-dev or libnode-dev (Debian / Ubuntu)
     * rpm: v8-devel (Fedora, EPEL)
     * brew: v8 (OSX)
     * csw: libv8_dev (Solaris)
    Alternatively, on Linux (x86_64) or MacOS you can set environment variable:
        DOWNLOAD_STATIC_LIBV8=1
    to automatically download a static version of libv8.
    To use a custom libv8, set INCLUDE_DIR and LIB_DIR manually via:
    R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
    ---------------------------[ ERROR MESSAGE ]----------------------------
    <stdin>:1:16: fatal error: v8.h: No such file or directory
    compilation terminated.
    ------------------------------------------------------------------------
    ERROR: configuration failed for package ‘V8’
    * removing ‘/home/lixx5010/.libraries/R/3.6/library/V8’
    Warning in install.packages :
      installation of package ‘V8’ had non-zero exit status
    ERROR: dependency ‘V8’ is not available for package ‘rstan’
    * removing ‘/home/lixx5010/.libraries/R/3.6/library/rstan’
    Warning in install.packages :
      installation of package ‘rstan’ had non-zero exit status
    
    The downloaded source packages are in
        ‘/var/tmp/pbs.50604.compute.cla/RtmpWo0rb2/downloaded_packages’

Then I try to load the library but am told there is no such library installed. The whole error message is too confusing to me. Please help! Thanks!

2

Answers


  1. I’m running R under Ubuntu 18.04 and the following command worked for me.

    apt-get install libv8-dev

    Login or Signup to reply.
  2. The answer from @CompToxDoc works for ubuntu, the more general solution that works on any Linux distribution is to run the following in the R terminal.

    Sys.setenv("DOWNLOAD_STATIC_LIBV8"=1)

    and then try again.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search