Encountering error when installing rpy2: Tried to guess R's HOME but no R command in the PATH

10,713

Download the rpy2‑2.7.5‑cp35‑none‑win_amd64.whl file from Christoph Gohlke's Python Extension Packages for Windows repository here. Using the command line, change to the download folder and run:

pip install rpy2‑2.5.5‑cp34‑none‑win_amd64.whl

This should solve the R directory issue and rpy2 should install nicely. All credit to MattDMo.

Share:
10,713
Matt Stone
Author by

Matt Stone

Updated on June 09, 2022

Comments

  • Matt Stone
    Matt Stone almost 2 years

    I've seen a lot of posts here and elsewhere about this error, but none of the proposed solutions appear to be relevant. I'm on Python 2.7.9, I have an R executable in my path, and I'm trying to install it on an RHEL server not on Windows.

    Here's the specific error I'm seeing. Does anybody have any idea what would be causing it or how to fix it? Thanks!

    $ pip install rpy2
    Downloading/unpacking rpy2
      Downloading rpy2-2.5.6.tar.gz (165kB): 165kB downloaded
      Running setup.py (path:/tmp/pip_build_my520/rpy2/setup.py) egg_info for package rpy2
        Error: Tried to guess R's HOME but no R command in the PATH.
        Complete output from command python setup.py egg_info:
        Error: Tried to guess R's HOME but no R command in the PATH.
    
  • Ruby
    Ruby about 7 years
    Just wanted to add: if cp34 didn't work, try download rpy2-2.7.8-cp27-none-win_amd64.whl if you use python27.
  • Sher Afghan
    Sher Afghan almost 5 years
    I am getting a similar error on Heroku and I can't figure how to apply this on Heroku. In my case when Heroku get to the line for installing rpy2 in my requirements file, it goes to the following link for downloading rpy2 and then produces the error. files.pythonhosted.org/packages/02/d1/…