I'm trying to install rpy2 in Ubuntu for Windows with the command pip install rpy2
, which yields the following error message:
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-isr_d1d8/rpy2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-isr_d1d8/rpy2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-isr_d1d8/rpy2/pip-egg-info
cwd: /tmp/pip-install-isr_d1d8/rpy2/
Complete output (9 lines):
Unable to determine R home: [Errno 2] No such file or directory: 'R'
/home/ziv/.local/lib/python3.8/site-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 0.23ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
/home/ziv/.local/lib/python3.8/site-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 0.1.36ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
/home/ziv/.local/lib/python3.8/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
Unable to determine R home: [Errno 2] No such file or directory: 'R'
Error: rpy2 in API mode cannot be built without R in the PATH or R_HOME defined. Correct this or force ABI mode-only by defining the environment variable RPY2_CFFI_MODE=ABI
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I tried following the instructions in the message and used the command RPY2_CFFI_MODE=ABI
. I couldn't find where the log files that are referred to in the above message are. I also added R to the PATH with the command export PATH=$PATH:/mnt/c/Program\ Files/R/R-4.2.1/bin/x64/R.exe
, as well as setting an R_HOME variable: R_HOME=/mnt/c/Program\ Files/R/R-4.2.1/bin/x64/
. I still got the error message after trying these solutions.
Any ideas?
lsb_release -a
. – Ziv Oct 30 '22 at 09:16