简体   繁体   中英

rpy2 installation error in Ubuntu

I've been trying to install rpy2 and install an R package from source.... I first installed rpy2 through binstar using conda. That seemed to install alright, but I got the error below when I tried compiling my R package from source.

So I uninstalled R and removed the rpy2 conda package. Then I re-installed R, and tried

pip install rpy2

But this fails to install and produces the following error:

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/share/R/include -I/home/alex/anaconda/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/include/signal.h:28:0,

                 from ./rpy/rinterface/_rinterface.c:51:

/usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directory

 #  include <sys/cdefs.h>

                         ^

compilation terminated.

error: command 'gcc' failed with exit status 1

I imagine that the conda package I installed the first time ran into a similar problem, but it was only uncovered by trying to compile the R package from source? It complained about the same cdefs.h file...

Happy to give any more details that are needed to debug

I've been building out conda packages for R and related packages (include rpy2 ). Eventually they will be in the default conda repos, but until then, you can get it with conda install -c asmeurer rpy2 (this will also install and use my build of R itself).

A simple solution that worked for me was to just do sudo apt-get install python-rpy2 . It worked flawlessly (assuming you already have R installed). And this way you don't need anaconda

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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