由于Rcpp的问题,无法安装R软件包

时间:2017-03-23 08:56:18

标签: r anaconda ubuntu-16.04 rcpp

重现:

  1. 按照https://github.com/yencarnacion/GCP-jupyter-notebook
  2. 的自述文件中的说明操作
  3. 打开一个R jupyter笔记本并执行:

    system("mkdir -p ~/anaconda3/lib/R/library", intern=TRUE)

    system("echo R_LIBS=~/anaconda3/lib/R/library > ~/.Renviron", intern=TRUE)

    * Then do a Kernel>Restart and in the first cell of your notebook put:

    .libPaths("~/anaconda3/lib/R/library")

  4. 用户ubuntu执行
    • wget https://cran.rstudio.com/src/contrib/Rcpp_0.12.10.tar.gz
  5. 用户ubuntu:
    • /usr/lib/anaconda/lib/R/bin/R CMD INSTALL --library=~/anaconda3/lib/R/library Rcpp_0.12.10.tar.gz
  6. 这是我从/usr/lib/anaconda/lib/R/bin/R CMD INSTALL --library=~/anaconda3/lib/R/library Rcpp_0.12.10.tar.gz获得的输出:

    * installing *source* package ‘Rcpp’ ...
    ** package ‘Rcpp’ successfully unpacked and MD5 sums checked
    ** libs
    g++ -I/usr/lib/anaconda/lib/R/include -DNDEBUG -I../inst/include/ -I/usr/lib/anaconda/include    -fpic  -I/usr/lib/anaconda/include  -c Date.cpp -o Date.o
    g++ -I/usr/lib/anaconda/lib/R/include -DNDEBUG -I../inst/include/ -I/usr/lib/anaconda/include    -fpic  -I/usr/lib/anaconda/include  -c Module.cpp -o Module.o
    g++ -I/usr/lib/anaconda/lib/R/include -DNDEBUG -I../inst/include/ -I/usr/lib/anaconda/include    -fpic  -I/usr/lib/anaconda/include  -c Rcpp_init.cpp -o Rcpp_init.o
    g++ -I/usr/lib/anaconda/lib/R/include -DNDEBUG -I../inst/include/ -I/usr/lib/anaconda/include    -fpic  -I/usr/lib/anaconda/include  -c api.cpp -o api.o
    g++ -I/usr/lib/anaconda/lib/R/include -DNDEBUG -I../inst/include/ -I/usr/lib/anaconda/include    -fpic  -I/usr/lib/anaconda/include  -c attributes.cpp -o attributes.o
    g++ -I/usr/lib/anaconda/lib/R/include -DNDEBUG -I../inst/include/ -I/usr/lib/anaconda/include    -fpic  -I/usr/lib/anaconda/include  -c barrier.cpp -o barrier.o
    g++ -shared -L/usr/lib/anaconda/lib/R/lib -L/usr/lib/anaconda/lib -lgfortran -o Rcpp.so Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o -L/usr/lib/anaconda/lib/R/lib -lR
    installing to /home/ubuntu/anaconda3/lib/R/library/Rcpp/libs
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
    Error in dyn.load(file, DLLpath = DLLpath, ...) : 
      unable to load shared object '/home/ubuntu/anaconda3/lib/R/library/Rcpp/libs/Rcpp.so':
      /home/ubuntu/anaconda3/lib/R/library/Rcpp/libs/Rcpp.so: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev
    Error: loading failed
    Execution halted
    ERROR: loading failed
    * removing ‘/home/ubuntu/anaconda3/lib/R/library/Rcpp’
    

    由于Rcpp问题,我无法devtools::install_github('rstudio/leaflet')等。

    注意:此问题可能与Rcpp package in R not install ubuntu 14.04

    有关

2 个答案:

答案 0 :(得分:1)

您可以通过conda安装Rcpp:

conda install r-rcpp

答案 1 :(得分:0)

仅供参考,您可以使用GCP的新AI Platform Notebooks在几秒钟内在GCP上为R创建Jupyter笔记本。

在GCP控制台中,转到AI Notebooks-> New Instance->选择R。您应该能够安装所需的任何R包