Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing rpy2 for Python 3 using pip

I am trying to install the rpy2 package for python 3 on Windows 7. So I simply typed pip install rpy2 in the command line. However, it fails for a reason I do not understand, could anyone clear this up please? It threw back the following in the command line:

    Collecting rpy2
    Using cached rpy2-2.8.2.tar.gz
    Complete output from command python setup.py egg_info:
    Warning: 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 C:\Users\...\AppData\Local\Temp\pip-build-14jn4kdx\rpy2\
like image 700
splinter Avatar asked Aug 15 '16 12:08

splinter


People also ask

Does rpy2 work with Python 3?

rpy2 is almost certainly not working with Python 2.6. Older Python versions are even less likely to work. While Python 3.3 should be working, earlier version of Python 3 are not expected to (they might work, they might not - you are on your own). Rpy2 is not expected to work at all with an R version < 2.8.

How do I download rpy2?

Installing rpy2 First up, install some packages. You must have Python >=3.7 and R >= 4.0 installed to use rpy2 3.5. 2. Once R is installed, install the rpy2 package by running pip install rpy2 .

Do I need to install R for rpy2?

rpy2 will typically require an R version that is not much older than itself. This means that even if your system has R pre-installed, there is a chance that the version is too old to be compaible with rpy2. At the time of this writing, the latest rpy2 version is 2.8 and requires R 3.2 or higher.

How do I install rpy2 on Windows?

Open a cmd window (as Administrator) in the . whl's download dir. Set R_USER env var to current username: set R_USER=%USERNAME% python -m pip install rpy2‑2.9.


Video Answer


3 Answers

There is no official support of windows.

There exists pre-compiled binaries (see: https://rpy2.github.io/doc/latest/html/overview.html#microsoft-s-windows-precompiled-binaries) but they are for an older release.

At the time of writing using the Linux subsystem available with Windows 10 might be the best options.

like image 182
lgautier Avatar answered Oct 19 '22 02:10

lgautier


it works fine with conda on windows

conda install rpy2
like image 36
Nobel Avatar answered Oct 19 '22 04:10

Nobel


Are your R binaries in your PATH variable?

Try this in your command prompt:

path = C:\path\to\R
pip install rpy2
like image 2
blankpanda Avatar answered Oct 19 '22 02:10

blankpanda