rpy2安装错误(操作系统:linux mint 17 | R 3.1.2 | python 2.7.6)

时间:2014-11-25 20:56:13

标签: rpy2

当我运行'sudo pip install rpy2'时,我收到了很多编译错误。

Here is the full dump of all the errors这是一个例子,除了:

 Compilation parameters for rpy2's C components:
        include_dirs    = ['/usr/share/R/include']
        library_dirs    = ['/usr/lib/R/lib']
        libraries       = ['R', 'pcre', 'lzma', 'bz2', 'z', 'rt', 'dl', 'm']
        extra_link_args = ['-Wl,--export-dynamic', '-fopenmp']

R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
building 'rpy2.rinterface._rinterface' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -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/share/R/include -I/usr/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/share/R/include/R.h:46:0,
                 from ./rpy/rinterface/_rinterface.h:8,
                 from ./rpy/rinterface/_rinterface.c:58:
/usr/share/R/include/R_ext/Memory.h:40:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 int R_gc_running();
 ^
In file included from ./rpy/rinterface/_rinterface.h:9:0,
                 from ./rpy/rinterface/_rinterface.c:58:
/usr/share/R/include/Rinternals.h:831:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 const char *R_curErrorBuf();
 ^
In file included from ./rpy/rinterface/_rinterface.c:70:0:
/usr/share/R/include/Rinterface.h:129:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern void (*ptr_R_ProcessEvents)();
 ^
In file included from ./rpy/rinterface/_rinterface.c:79:0:
/usr/share/R/include/R_ext/Rdynload.h:32:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 typedef void * (*DL_FUNC)();
 ^
./rpy/rinterface/_rinterface.c:86:31: fatal error: readline/readline.h: No such file or directory
 #include <readline/readline.h>
                               ^
compilation terminated.

一些背景知识。以前破坏了ipython notebook dev版本的安装并且已经恢复到pip存储库版本。不确定这是否起作用。能够在此之前让R魔法工作一点点。

我确保运行'apt-get updates','pip uninstall rpy2','apt-get purge python-rpy2&amp;&amp;尝试重新安装之前,apt-get删除python-rpy2'。为了检查是否有任何残留文件,我在ipython中运行了'import rpy2',导致找不到模块错误(好的,没有什么是挥之不去的)。

不确定从何处开始排除故障。建议表示赞赏。


编辑:2014年11月26日

安装以下依赖项后,它工作正常:

  • apt-get install libreadline-dev
  • apt-get install r-base r-base-dev python-dev python-setuptools

1 个答案:

答案 0 :(得分:0)

您需要readline库的标题:

apt-get install libreadline-dev