我正在尝试在 ubuntu(11.04,natty narwhal)上构建 R(尝试 2.14.2 和 2.15)和 rpy2(2.2.6,python 2.7.1),以将其部署到自定义目录(以下称为 /home/ me/lib/R),因为我没有 root 访问权限,但需要比服务器上可用的更新版本。
构建等的详细信息进一步下降,但即使在运行 rpy2 的测试时,我总是会收到以下错误:
/home/me/lib/pythonlib/lib/python/rpy2/rinterface/__init__.py in <module>()
---> 87 from rpy2.rinterface._rinterface import *
ImportError: libRblas.so: cannot open shared object file: No such file or directory
WARNING: Failure executing file: <experiments/arrangement/test_smacof_arrange.py>
我确定我正在调用正确的 rpy2 模块(我的定制模块),该模块是针对定制构建的 R 版本构建的。为此,我正在执行以下操作:
我首先在 ubuntu 上构建 R-base
wget http://cran.r-project.org/bin/linux/ubuntu/natty/r-base_2.14.2.orig.tar.gz # untar and go to directory # enable-R-shblib flag is needed for rpy2 linking, enable-BLAS-shlib was included # because I hoped to solve the problem, which doesnt change anything however ./configure --enable-R-shlib --enable-BLAS-shlib --prefix=/home/me/lib/R make make install
然后我针对这个 R 构建构建 rpy2
wget http://pypi.python.org/packages/source/r/rpy2/rpy2-2.2.6.tar.gz # untar and go to directory # build rpy2, by providing the r-home-lib and r-home flags, and deploy to custom dir python setup.py build --r-home /home/me/lib/R --r-home-lib /home/me/lib/R/lib64/R/lib install --home /home/me/lib/pythonlib
我还调整了我的 pythonpath 以在 /home/me/lib/pythonlib 中查找模块,所以问题不存在。python构建返回正确的配置(注意Rblas出现在这里!)
Configuration for R as a library: include_dirs: ('/home/me/lib/R/lib64/R/include',) libraries: ('R', 'Rblas', 'Rlapack') library_dirs: ('/home/me/lib/R/lib64/R/lib',) extra_link_args: ()
我试图追查错误,但没有结束。/home/me/lib/R/lib64/R/lib 包含 libRblas.so,但是有一件事情看起来很奇怪,那就是 libRblas.so 没有与 libR.so 正确链接,但我不确定是否这会导致错误,我也不知道如何修复它。
>> ldd -d libR.so
linux-vdso.so.1 => (0x00007fffcec58000)
libRblas.so => not found
libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007fe63d21d000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe63cf97000)
...
任何帮助将不胜感激!