简体   繁体   中英

Failed to 'pip3 install rpy2' in linux

everyone. I tried to install rpy2 in Centos6.10, with Python 3.6.4 and R version 3.5.2. I used the comand 'pip3 install rpy2'. I got the following errors:

cwd: /tmp/pip-install-7bxzxlni/rpy2_0e939a480cc0488d918a202af1b64127/
Complete output (153 lines):
['cffi>=1.10.0', 'jinja2', 'pytz', 'tzlocal']
running install
running build
cffi mode: CFFI_MODE.ANY
running build_py
file _rinterface_cffi_abi.py (for module _rinterface_cffi_abi) not found
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/rpy2
...(many copy information like this "copying ./rpy2/rinterface_lib/memorymanagement.py -> build/lib.linux-x86_64-3.6/rpy2/rinterface_lib")

file _rinterface_cffi_abi.py (for module _rinterface_cffi_abi) not found
generating cffi module 'build/lib.linux-x86_64-3.6/_rinterface_cffi_abi.py'
running build_ext
generating cffi module 'build/temp.linux-x86_64-3.6/_rinterface_cffi_api.c'
creating build/temp.linux-x86_64-3.6
building '_rinterface_cffi_api' extension
creating build/temp.linux-x86_64-3.6/build
creating build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6
gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -O2 -pipe -fPIC -DRPY2_RLEN_LONG=True -DR_INTERFACE_PTRS=True -Irpy2/rinterface_lib/ -I/home/work/.jumbo/include/python3.6m -c build/temp.linux-x86_64-3.6/_rinterface_cffi_api.c -o build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/_rinterface_cffi_api.o
In file included from build/temp.linux-x86_64-3.6/_rinterface_cffi_api.c:569:
rpy2/rinterface_lib/R_API.h:199: warning: function declaration isn’t a prototype
In file included from build/temp.linux-x86_64-3.6/_rinterface_cffi_api.c:570:
rpy2/rinterface_lib/R_API_eventloop.h:26: error: redefinition of typedef ‘InputHandler’
rpy2/rinterface_lib/R_API_eventloop.h:8: note: previous declaration of ‘InputHandler’ was here
error: command 'gcc' failed with exit status 1
----------------------------------------
    ERROR: Command errored out with exit status 1: /home/work/.jumbo/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7bxzxlni/rpy2_0e939a480cc0488d918a202af1b64127/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7bxzxlni/rpy2_0e939a480cc0488d918a202af1b64127/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-lx5dv6cc/install-record.txt --single-version-externally-managed --compile --install-headers /home/work/.jumbo/include/python3.6m/rpy2 Check the logs for full command output.

'''

Since there is "command 'gcc' failed with exit status 1", I installed all things mentioned in here . Since "Command errored out with exit status 1", I referred here~ , eg, I have tried 'pip3 install --upgrade rpy2' and I also tried to first upgrade my pip3. But these ways did not help me. Besides, I followed by this way and this~ . The first did not help and the latter will pose 'error: option --r-home not recognized' after my command 'python3 setup.py build --r-home /usr/lib64/R/ install'.

Here is some other information:

    echo$PATH
    bash:echo/home/work/.jumbo/bin/core_perl:/home/work/.jumbo/bin:/home/work/.jumbo/bin/core_perl:/home/work/.jumbo/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/opt/bin:/home/opt/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/bin:/home/opt/bin:/usr/local/git/bin:/home/work/bin: No such file or directory

    echo$R_HOME
    bash: echo/usr/lib64/R: No such file or directory

    echo$LD_LIBRARY_PATH
    

Please help me!

I get my "R_HOME" by starting R and input 'Sys.getenv("R_HOME")'. The output is "/usr/lib64/R". This is why I creat the variable "R_HOME" by "export R_HOME=/usr/lib64/R" in my /etc/profile. Now I use 'which R' and I get '/usr/bin/R', so I changed "R_HOME" variable from "/usr/lib64/R" into "/usr/bin/" which solved my problem. Oh yeah! I hope my experience can help some guys.

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