ITの隊長のブログ

ITの隊長のブログです。Rubyを使って仕事しています。最近も色々やっているお(^ω^ = ^ω^)

Ubuntuにrpy2を入れたい

スポンサードリンク

AnacondaがインストールされたUbuntuでrpy2を使いたいのでpipで入れようとした。

$ pip install rpy2

# ...
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: cffi mode: CFFI_MODE.ANY
    Error: rpy2 in API mode cannot be built without R in the PATH or R_HOME defined. Correct this or force ABI mode-only by defining the environment variable RPY2_CFFI_MODE=ABI
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-33y9jj0x/rpy2/

調べてみるとRがインストールされていないからだと。

$ apt install r-base -y

このあと再度pipを実行したらうまくいった。