陳冠穎
陳冠穎

Reputation: 323

Cannot install rpy2 via pip in MAC OS

I cannot install rpy2(Python package) via pip or PyCharm in MAC OS.
But I can run Python(via PyCharm) and R(via RStudio) successfully.....
The main error message is

"Error: Tried to guess R's HOME but no command (R) in the PATH." and "Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-OtKzsd/rpy2/".

I guess the problem maybe related to R environment PATH setting?
But I still don't know how to fix this problem....
The complete error message is below:

host-217:~ ChenGuanYing$ sudo pip install rpy2
The directory '/Users/ChenGuanYing/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/ChenGuanYing/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting rpy2
  Downloading rpy2-2.7.8.tar.gz (178kB)
    100% |████████████████████████████████| 184kB 1.1MB/s 
    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 /private/tmp/pip-build-OtKzsd/rpy2/

enter image description here

Upvotes: 1

Views: 805

Answers (1)

zhibo
zhibo

Reputation: 381

Two possible solutions, as suggested in the error message:

  1. export R_HOME=
  2. put R command in the system PATH

Upvotes: 1

Related Questions