How to install rpy2 on colab.research.google? I tried the command:
pip install rpy2
import rpy2
but it doesn't work. This is the error obtained:
Collecting rpy2
Using cached https://files.pythonhosted.org/packages/02/d1/074ffbbe7b4bf74c60b75d74c8e67a1e4515b0d85f85cd6540e39610754a/rpy2-2.9.5.tar.gz
Complete output from command python setup.py egg_info:
Error: Tried to guess R's HOME but no command 'R' in the PATH.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-je87ula0/rpy2/
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-15-93ecdf466471> in <module>()
1 get_ipython().system('pip install rpy2')
----> 2 import rpy2
ModuleNotFoundError: No module named 'rpy2'
Thanks in advance for your help, Ines.
Write !pip install rpy2
instead of pip install rpy2
EDIT
According to the documentation of rpy2 that can be found here :
Running Rpy2 will require compiled libraries for R, Python, and readline; building rpy2 will require the corresponding development headers (check the documentation for more information about building rpy2).
So, this should work
!apt-get install r-base
!pip install rpy2
!apt-get install r-base
!pip install rpy2
import rpy2
It works ! Thank you Anwarvicc
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.