简体   繁体   English

在ubuntu上建立R(cran)+ rpy2 - >找不到libRblas.so

[英]Building R (cran) + rpy2 on ubuntu -> libRblas.so not found

I am trying to build R (tried 2.14.2 and 2.15) and rpy2 (2.2.6, python 2.7.1) on ubuntu (11.04, natty narwhal), to deploy it to a custom directory (in the following called /home/me/lib/R), since I do not have root access, but need a newer version than available on the server. 我试图在ubuntu(11.04,natty narwhal)上构建R(尝试2.14.2和2.15)和rpy2(2.2.6,python 2.7.1),将其部署到自定义目录(在下面名为/ home / me / lib / R),因为我没有root访问权限,但需要比服务器上提供的版本更新的版本。

Details of build etc further down, but even when running the tests of rpy2, I always get the following error: 构建等细节进一步向下,但即使运行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>

I am sure I am calling the right rpy2 module (my custom built one) which has been built against custom built R version. 我确信我正在调用正确的rpy2模块(我自定义构建的模块),它是针对自定义构建的R版本构建的。 To do this I am doing the following: 要做到这一点,我正在做以下事情:

  1. I first Build R-base on ubuntu 我首先在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 
  2. I then build rpy2 against this R build 然后我针对这个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 

    I also have adapted my pythonpath to find modules in /home/me/lib/pythonlib, so the problem isn't there. 我也调整了我的pythonpath来查找/ home / me / lib / pythonlib中的模块,所以问题不在那里。 The python build returns the correct configuration (note that Rblas appears here!) 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: () 

I have tried to track down the error, but to no end. 我试图追查错误,但没有尽头。 /home/me/lib/R/lib64/R/lib contains libRblas.so, but there is one thing which seems strange however, which is that libRblas.so is not linked correctly from libR.so, but I am not sure wether this causes the error, nor do I know how to fix it. / 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)
...

Any help would be greatly appreciated! 任何帮助将不胜感激!

对于遇到此问题的其他人,我能够通过确保将R库添加到bashrc中的库路径来解决它:

export LD_LIBRARY_PATH="R-install-location/lib65/R/lib:$LD_LIBRARY_PATH"

Briefly: 简述:

  1. Why build R on Ubuntu? 为什么在Ubuntu上构建R? Just grab the existing and current binaries from the CRAN repo as per the README at http://cran.r-project.org/bin/linux/ubuntu -- these are ports of the current Debian packages made available via CRAN to overcome the normal Ubuntu publishing lag. 只需按照http://cran.r-project.org/bin/linux/ubuntu上的自述文件从CRAN repo中获取现有和当前二进制文件 - 这些是当前Debian软件包的端口,可通过CRAN获取以克服正常的Ubuntu发布滞后。

  2. Whenever I need a newer (small) package on Ubuntu, I just grab the Debian package sources and rebuild those on Ubuntu. 每当我在Ubuntu上需要一个更新的(小)包时,我只需抓住Debian包源并在Ubuntu上重建它们。 There should be ample HOWTO on the net on how to build a package; 关于如何建立一个包,网上应该有足够的HOWTO; the minimum is to a) down the triplet .orig.tar.gz, .diff.gz and .dsc and use dpkg-sourcepackage -x *.dsc to expand and then b) change into the directory and run sudo debian/rules binary (provided you have all Build-Depends: packages installed). 最小的是a)关闭三元组.orig.tar.gz,.diff.gz和.dsc并使用dpkg-sourcepackage -x *.dsc进行扩展,然后b)切换到目录并运行sudo debian/rules binary (如果您已安装所有Build-Depends:软件包)。 You can even use apt-get to do these steps for you but it is getting a little beyond the scope of this question... 您甚至可以使用apt-get为您执行这些步骤,但它会超出此问题的范围......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM