How to install rpy2 via conda using default R inst

2019-06-27 09:14发布

问题:

I use the Anaconda Python distribution on Ubuntu linux and would like to use R magics in IPython notebooks. Is there a way to install rpy2 with the conda distribution and use my current default R installation at /usr/bin/R? My goal is to keep the current R installation as is without installing R or other R packages via conda.

This response to a related question suggests using a recipe for doing so on mac, but doesn't work for me:

conda skeleton pypi rpy2
conda build rpy2
conda install rpy2 --use-local

The build command yields the follow error:

Error: No packages found in current linux-64 channels matching:  singledispatch

I can install singledispatch via binstar:

conda install -c https://conda.binstar.org/asmeurer singledispatch

conda list | grep "singledispatch"
singledispatch            3.4.0.3                  py27_1

But I get the same error regarding there being no packages found in current linux-64 channels.

回答1:

I had a similar issue with the package not installing in the proper place, I would recommend instead using apt instead of conda

sudo apt install python-rpy2

edit: * note official support for rpy2 has been discontinued for 2.7 *