1

I am trying to fix the error related to pandas.rpy.common like this:

# activate python 2.7 env
$ source activate py27

# this says requirements satisfied
$ pip install rpy2
Requirement already satisfied: rpy2 in ./lib/python2.7/site-packages
Requirement already satisfied: singledispatch in ./lib/python2.7/site-packages/singledispatch-3.4.0.3-py2.7.egg (from rpy2)
Requirement already satisfied: six in ./lib/python2.7/site-packages (from rpy2)

# test if rpy2, pandas is installed
$ cat test.py 
import rpy2 # ok
import pandas # ok
import pandas.rpy.common # this line throws an error

# run the script
$ python test.py 
Traceback (most recent call last):
  File "/home/rathik/test.py", line 3, in <module>
    import pandas.rpy.common
ImportError: No module named rpy.common

I have read some related questions, set my R_HOME and R_USER but nothing is working:

$ echo $R_HOME 
/home/rathik/tools/miniconda3/envs/py27/bin/R
$ echo $R_USER
/home/rathik/tools/miniconda3/envs/py27/lib/python2.7/site-packages/rpy2

Any help would be much appreciated.

Thanks!

Komal Rathi
  • 4,164
  • 13
  • 60
  • 98
  • The first line of the documentation when searching "pandas rpy common": "In v0.16.0, the pandas.rpy interface has been deprecated and will be removed in a future version. Similar functionality can be accessed through the rpy2 project." http://pandas.pydata.org/pandas-docs/version/0.18.1/r_interface.html – roganjosh Jul 13 '17 at 15:56
  • 1
    Look at this [post](https://stackoverflow.com/a/21840826/8201433) – Sriram Sitharaman Jul 13 '17 at 15:56
  • @roganjosh This is required by a software (http://www.well.ox.ac.uk/~rivas/mamba/) and I can't change the dependencies. – Komal Rathi Jul 13 '17 at 16:08
  • But the module doesn't exist in later versions of pandas. If there really is no other way, I guess you'll have to `pip uninstall pandas` and then `pip install pandas=1.15` - the version before it was deprecated. – roganjosh Jul 13 '17 at 16:09
  • @Sriram Am I missing something? Not sure what you are pointing to. I have already looked through a dozen posts and I do use pip to install rpy2. – Komal Rathi Jul 13 '17 at 16:10
  • @roganjosh Thanks! I installed v0.15.2 `pip install pandas=0.15.2 `. But now I have another issue altogether `cannot find system Renviron` which I will post as a separate question. – Komal Rathi Jul 13 '17 at 16:36

0 Answers0