【问题标题】:anaconda R - Rcpp erroranaconda R - Rcpp 错误
【发布时间】:2016-09-20 21:51:10
【问题描述】:

设置(我正在使用 anaconda 分布式 R):

g++ (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Rcpp -- 0.12.5

小例子:

library(Rcpp)
evalCpp("1+1")

错误:

Error in dyn.load("/tmp/RtmpGI3wKi/sourcecpp_6c2722bad7ef/sourceCpp_1.so") : 
  unable to load shared object '/tmp/RtmpGI3wKi/sourcecpp_6c2722bad7ef/sourceCpp_1.so':
  /tmp/RtmpGI3wKi/sourcecpp_6c2722bad7ef/sourceCpp_1.so: undefined symbol: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv

我在 anaconda google groups 和 stackoverflow 上的 here 上看到了一个非常相似的错误,但没有任何补救提示。

【问题讨论】:

    标签: rcpp


    【解决方案1】:

    你必须和那些给你 Anaconda 的好人谈谈。在 Debian 和 Ubuntu 上,一切都“正常工作”——并且可以预期,因为部分开发人员使用该平台:

    在我的(其中一个)运行 Ubuntu 16.04 的工作站上:

    R> library(Rcpp)
    R> evalCpp("1+2")
    [1] 3
    R> 
    

    在新推出的 Rocker r-base 容器中同上(运行 Debian 测试并通过 apt-get 拉入 Rcpp):

    $ docker run --rm -ti r-base /bin/bash
    root@fb2451f888cb:/# apt-get update
    Get:2 http://security.debian.org testing/updates InRelease [68.2 kB]                                      
    Get:1 http://debian.cs.binghamton.edu/debian sid InRelease [209 kB]                                           
    Get:3 http://debian.cs.binghamton.edu/debian testing InRelease [251 kB]            
    Get:4 http://debian.cs.binghamton.edu/debian testing-updates InRelease [124 kB]
    Get:5 http://debian.cs.binghamton.edu/debian sid/main amd64 Packages [9,671 kB]
    Get:6 http://debian.cs.binghamton.edu/debian testing/main amd64 Packages [10.4 MB]
    Fetched 20.7 MB in 4s (4,476 kB/s)                          
    Reading package lists... Done
    root@fb2451f888cb:/# apt-get install r-cran-rcpp
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following additional packages will be installed:
      r-cran-pkgkitten
    Suggested packages:
      r-cran-inline
    The following NEW packages will be installed:
      r-cran-pkgkitten r-cran-rcpp
    0 upgraded, 2 newly installed, 0 to remove and 102 not upgraded.
    Need to get 2,187 kB of archives.
    After this operation, 9,187 kB of additional disk space will be used.
    Do you want to continue? [Y/n] 
    Get:1 http://debian.cs.binghamton.edu/debian testing/main amd64 r-cran-pkgkitten all 0.1.3-1 [18.3 kB]
    Get:2 http://debian.cs.binghamton.edu/debian testing/main amd64 r-cran-rcpp amd64 0.12.7-1 [2,169 kB]
    Fetched 2,187 kB in 0s (2,324 kB/s)    
    debconf: delaying package configuration, since apt-utils is not installed
    Selecting previously unselected package r-cran-pkgkitten.
    (Reading database ... 16975 files and directories currently installed.)
    Preparing to unpack .../r-cran-pkgkitten_0.1.3-1_all.deb ...
    Unpacking r-cran-pkgkitten (0.1.3-1) ...
    Selecting previously unselected package r-cran-rcpp.
    Preparing to unpack .../r-cran-rcpp_0.12.7-1_amd64.deb ...
    Unpacking r-cran-rcpp (0.12.7-1) ...
    Setting up r-cran-pkgkitten (0.1.3-1) ...
    Setting up r-cran-rcpp (0.12.7-1) ...
    root@fb2451f888cb:/# R
    
    R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
    Copyright (C) 2016 The R Foundation for Statistical Computing
    Platform: x86_64-pc-linux-gnu (64-bit)
    
    R is free software and comes with ABSOLUTELY NO WARRANTY.
    You are welcome to redistribute it under certain conditions.
    Type 'license()' or 'licence()' for distribution details.
    
      Natural language support but running in an English locale
    
    R is a collaborative project with many contributors.
    Type 'contributors()' for more information and
    'citation()' on how to cite R or R packages in publications.
    
    Type 'demo()' for some demos, 'help()' for on-line help, or
    'help.start()' for an HTML browser interface to help.
    Type 'q()' to quit R.
    
    > library(Rcpp)
    > evalCpp("1+2")
    [1] 3
    > 
    

    【讨论】:

    • 我期待它与 Anaconda 相关。感谢您的回复。
    • 尝试从 CRAN 的源代码安装 Rcpp。那应该行得通。 (发行版二进制文件可能过时。将其用作后备。)
    • 尝试从源代码安装 0.12.7。它得到一个(几乎)相同的错误。看来我将不得不放弃通过 Anaconda 管理 R 的希望。再次感谢。
    • R 社区对 R、CRAN 等的工作方式非常满意,因此我们大多数人都没有看到需要 Anaconda。在 Ubuntu 上,Python 也可以正常工作,所以我也不需要它。您的里程当然可能会有所不同。
    猜你喜欢
    • 2015-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多