不能为我的生活安装rpy2 - gcc错误

时间:2015-06-29 13:56:48

标签: python r gcc rpy2

我在尝试在我丢失轨道的虚拟环境中在我的Ubuntu 14.04服务器上设置rpy2时遇到了很多不同的安装/构建错误。这是我设置iPython服务器的最后一步,但是我已经连续几天坚持rpy2安装了。我尝试了很多不同的东西,其中一些我肯定会相互冲突并让我的生活变得更加困难(例如双R版本安装),但是我放弃了在没有外界帮助的情况下尝试这样做。 / p>

我做过的各种事情:

  • 安装了python-dev和setuptools
  • 安装并更新了点子
  • 安装并更新了gcc
  • 从源代码构建并安装最新版本的R
  • 使用Dirk Eddelbuetel's Docker file
  • 从源代码构建并安装R(r-devel)的开发版本
  • [sudo] pip install rpy2,稳定的R 开发R
  • 使用稳定的R 开发R(设置--ignore-check-rversion选项)从源构建rpy2
  • easy_install rpy2
  • 使用和不使用R_HOME设置为稳定R的pip安装和源安装(当前默认R是不稳定的开发版本)

如果有人知道我能做些什么才能让这个工作,除了在干净的环境中从头开始,那么请让我知道 - 非常感谢。谢谢!!

我得到的当前错误如下:

(.venv)zacp@contentvalue:~/rpy2-2.6.0$ python setup.py build_ext --ignore-check-rversion install
R Under development (unstable) (2015-06-16 r68524) -- "Unsuffered Consequences"
setup.py:196: UserWarning: R did not seem to have the minimum required version number
  warnings.warn("R did not seem to have the minimum required version number")
/usr/local/lib/R/bin/R CMD config --ldflags
R was not built as a library
/usr/local/lib/R/bin/R CMD config --cppflags
R was not built as a library
setup.py:211: UserWarning: No include specified
  warnings.warn('No include specified')
setup.py:222: UserWarning: No libraries as -l arguments to the compiler.
  warnings.warn('No libraries as -l arguments to the compiler.')

    Compilation parameters for rpy2's C components:
        include_dirs    = []
        library_dirs    = []
        libraries       = []
        extra_link_args = []

running build_ext
R Under development (unstable) (2015-06-16 r68524) -- "Unsuffered Consequences"
setup.py:77: UserWarning: R did not seem to have the minimum required version number
  warnings.warn("R did not seem to have the minimum required version number")
building 'rpy2.rinterface._rinterface' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1 -DRIF_HAS_RSIGHAND=1 -DCSTACK_DEFNS=1 -DHAS_READLINE=1 -I./rpy/rinterface -I/usr/local/lib/python2.7.9/include/python2.7 -c ./rpy/rinterface/_rinterface.c -o build/temp.linux-x86_64-2.7/./rpy/rinterface/_rinterface.o
In file included from /usr/local/lib/python2.7.9/include/python2.7/Python.h:8:0,
                 from ./rpy/rinterface/_rinterface.c:55:
/usr/local/lib/python2.7.9/include/python2.7/pyconfig.h:1182:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
 #define _POSIX_C_SOURCE 200112L
 ^
In file included from /usr/include/signal.h:28:0,
                 from ./rpy/rinterface/_rinterface.c:51:
/usr/include/features.h:230:0: note: this is the location of the previous definition
 # define _POSIX_C_SOURCE 200809L
 ^
In file included from ./rpy/rinterface/_rinterface.c:58:0:
./rpy/rinterface/_rinterface.h:8:15: fatal error: R.h: No such file or directory
 #include <R.h>
               ^
compilation terminated.
error: command 'gcc' failed with exit status 1

2 个答案:

答案 0 :(得分:0)

我猜我用apt-get安装的R版本已经过时了。 R 3.0可能是好的&#34;根据{{​​3}},我想我误解了这些警告。 糟糕!

答案 1 :(得分:0)

根据pip - Unable to Install rpy2 on Ubuntu 14.04, missing R_ext/Rallocators.h: - Ask Ubuntu,您需要比R版本3.0.2更新的东西,而版本3.2已经足够了。这似乎是正确的,例如对于rpy2版本2.8.5。