Issue installing rpy2 inside Watson Studio Python

2019-08-23 04:00发布

I'm trying to install rpy2 inside a Watson Studio 'environment':

!pip install rpy2

However, the environments don't appear to have R available:

Collecting rpy2
  Downloading https://files.pythonhosted.org/packages/f1/98/c7652cc9d7fc0afce74d2c30a52b9c9ac391713a63d037e4ab8feb56c530/rpy2-2.9.4.tar.gz (194kB)
    100% |████████████████████████████████| 204kB 4.4MB/s eta 0:00:01
    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 /home/dsxuser/.tmp/pip-build-t7_r6q8e/rpy2/

How can I install rpy2 inside a Watson Studio Python 'Enviroment'? Is this possble?


Note: Watson Studio Environments are custom containers, so an answer should only be provided if the answer is known to work on Watson Studio Environments.

1条回答
【Aperson】
2楼-- · 2019-08-23 04:33

Use conda instead of pip. It knows how to install the R runtime. But beware, there are many packages that need to be installed...

!conda install rpy2

Fetching package metadata ........... Solving package specifications: .

Package plan for installation in environment /opt/conda/envs/DSX-Python35:

The following NEW packages will be INSTALLED:

_r-mutex:               1.0.0-mro_2               
binutils_impl_linux-64: 2.31.1-h6176602_1         
binutils_linux-64:      2.31.1-h6176602_3         
fribidi:                1.0.5-h7b6447c_0          
gcc_impl_linux-64:      7.3.0-habb00fd_1          
gcc_linux-64:           7.3.0-h553295d_3          
gfortran_impl_linux-64: 7.3.0-hdf63c60_1          
gfortran_linux-64:      7.3.0-h553295d_3          
gxx_impl_linux-64:      7.3.0-hdf63c60_1          
gxx_linux-64:           7.3.0-h553295d_3          
kiwisolver:             1.0.1-py35hf484d3e_0      
libcurl:                7.61.1-heec0ca6_0         
libuuid:                1.0.3-h1bed415_2          
make:                   4.2.1-h1bed415_1          
mro-base:               3.5.1-3                   
mro-base_impl:          3.5.1-h9a62091_0          
r-assertthat:           0.2.0-mro351hf348343_0    
r-bh:                   1.66.0_1-mro351hf348343_0 
r-bindr:                0.1.1-mro351hf348343_0    
r-bindrcpp:             0.2.2-mro351hebc1506_0    
r-bit:                  1.1_14-mro351hd10c6a6_0   
r-bit64:                0.9_7-mro351hd10c6a6_0    
r-blob:                 1.1.1-mro351hf348343_0    
r-cli:                  1.0.0-mro351hf348343_0    
r-crayon:               1.3.4-mro351hf348343_0    
r-dbi:                  1.0.0-mro351hf348343_0    
r-dbplyr:               1.2.2-mro351hf348343_0    
r-digest:               0.6.15-mro351hd10c6a6_0   
r-dplyr:                0.7.6-mro351hebc1506_0    
r-fansi:                0.2.3-mro351hd10c6a6_0    
r-glue:                 1.3.0-mro351hd10c6a6_0    
r-magrittr:             1.5-mro351hf348343_0      
r-memoise:              1.1.0-mro351hf348343_0    
r-pillar:               1.3.0-mro351hf348343_0    
r-pkgconfig:            2.0.1-mro351hf348343_0    
r-plogr:                0.2.0-mro351hf348343_0    
r-prettyunits:          1.0.2-mro351hf348343_0    
r-purrr:                0.2.5-mro351hd10c6a6_0    
r-r6:                   2.2.2-mro351hf348343_0    
r-rcpp:                 0.12.18-mro351hebc1506_0  
r-revoutils:            11.0.0-mro351_0           
r-revoutilsmath:        11.0.0-mro351_0           
r-rlang:                0.2.1-mro351hd10c6a6_0    
r-rsqlite:              2.1.1-mro351hebc1506_0    
r-tibble:               1.4.2-mro351hd10c6a6_0    
r-tidyselect:           0.2.4-mro351hebc1506_0    
r-utf8:                 1.1.4-mro351hd10c6a6_0    
rpy2:                   2.9.4-py35mro351h6853232_0

The following packages will be UPDATED:

cairo:                  1.14.12-h77bcde2_0         --> 1.14.12-h8948797_3     
curl:                   7.55.1-h78862de_4          --> 7.61.1-hbc83047_0      
dbus:                   1.10.22-h3b5a359_0         --> 1.13.2-h714fa37_1      
fontconfig:             2.12.4-h88586e7_1          --> 2.13.0-h9420a91_0      
freetype:               2.8-hab7d2ae_1             --> 2.9.1-h8a8886c_1       
glib:                   2.53.6-h5d9569c_2          --> 2.56.2-hd408876_0      
graphite2:              1.3.10-hf63cedd_1          --> 1.3.12-h23475e2_2      
graphviz:               2.40.1-h25d223c_0          --> 2.40.1-h21bd128_2      
gst-plugins-base:       1.12.2-he3457e5_0          --> 1.14.0-hbbd80ab_1      
gstreamer:              1.12.2-h4f93127_0          --> 1.14.0-hb453b48_1      
harfbuzz:               1.7.4-hc5b324e_0           --> 1.8.8-hffaf4a1_0       
libgcc-ng:              7.2.0-h7cc24e2_2           --> 8.2.0-hdf63c60_1       
libgfortran-ng:         7.2.0-h9f7466a_2           --> 7.3.0-hdf63c60_0       
libstdcxx-ng:           7.2.0-h7a57d05_2           --> 8.2.0-hdf63c60_1       
libxcb:                 1.12-hcd93eb1_4            --> 1.13-h1bed415_1        
libxml2:                2.9.4-h6b072ca_5           --> 2.9.8-h26e45fe_1       
matplotlib:             2.1.0-py35h2cbf27e_0       --> 2.2.3-py35hb69df0a_0   
pango:                  1.41.0-hd475d92_0          --> 1.42.4-h049681c_0      
pcre:                   8.41-hc27e229_1            --> 8.42-h439df22_0        
pillow:                 4.2.1-py35h03abc04_0       --> 5.2.0-py35heded4f4_0   
pycurl:                 7.43.0-py35h7a9665c_3      --> 7.43.0.2-py35hb7f436b_0
pyqt:                   5.6.0-py35h0e41ada_5       --> 5.9.2-py35h05f1152_2   
qt:                     5.6.2-h974d657_12          --> 5.9.6-h8703b6f_2       
sip:                    4.18.1-py35h9eaea60_2      --> 4.19.8-py35hf484d3e_0  
xz:                     5.2.3-h55aa19d_2           --> 5.2.4-h14c3975_4       
查看更多
登录 后发表回答