quanteda / spacyr

R wrapper to spaCy NLP
http://spacyr.quanteda.io
251 stars 38 forks source link

spacy_install() forces update to pip 10, incompatible with spacyr #120

Closed prokopyev closed 6 years ago

prokopyev commented 6 years ago

Just trying to get spacyr running for the first time.

spacy_install() leads to

The following NEW packages will be INSTALLED:
    ca-certificates: 2018.03.07-0           
    certifi:         2018.4.16-py36_0       
    libcxx:          4.0.1-h579ed51_0       
    libcxxabi:       4.0.1-hebd6815_0       
    libedit:         3.1.20170329-hb402a30_2
    libffi:          3.2.1-h475c297_4       
    ncurses:         6.1-h0a44026_0         
    openssl:         1.0.2o-h26aff7b_0      
    pip:             10.0.1-py36_0          
    python:          3.6.5-hc167b69_1 

Trying to initialize spacy after this, the error code is as follows:

> spacy_initialize()
Python space is already attached.  If you want to switch to a different Python, please restart R.
Error in py_run_file_impl(file, local, convert) : 
  AttributeError: module 'pip' has no attribute 'get_installed_distributions'

The core problem is described in this pip issue: https://github.com/pypa/pip/issues/5154

How to force install pip 9.0.1 inside anaconda using spacy_install()?

My session information:

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] reticulate_1.8 spacyr_0.9.9   quanteda_1.3.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17       magrittr_1.5       stopwords_0.9.0    munsell_0.4.3     
 [5] colorspace_1.3-2   lattice_0.20-35    rlang_0.2.1        fastmatch_1.1-0   
 [9] stringr_1.3.1      plyr_1.8.4         RcppProgress_0.4.1 tools_3.5.0       
[13] grid_3.5.0         data.table_1.11.4  gtable_0.2.0       yaml_2.1.19       
[17] RcppParallel_4.4.0 xgboost_0.71.1     lazyeval_0.2.1     assertthat_0.2.0  
[21] tibble_1.4.2       textreuse_0.1.4    Matrix_1.2-14      NLP_0.1-11        
[25] ggplot2_2.2.1      stringi_1.2.2      compiler_3.5.0     pillar_1.2.3      
[29] scales_0.5.0       jsonlite_1.5       lubridate_1.7.4   
> py_config()
python:         /Users/MacBookAir/anaconda/envs/spacy_condaenv/bin/python
libpython:      /Users/MacBookAir/anaconda/envs/spacy_condaenv/lib/libpython3.6m.dylib
pythonhome:     /Users/MacBookAir/anaconda/envs/spacy_condaenv:/Users/MacBookAir/anaconda/envs/spacy_condaenv
version:        3.6.5 |Anaconda, Inc.| (default, Apr 26 2018, 08:42:37)  [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
numpy:          /Users/MacBookAir/anaconda/envs/spacy_condaenv/lib/python3.6/site-packages/numpy
numpy_version:  1.14.5

NOTE: Python version was forced by use_python function
amatsuo commented 6 years ago

Sorry about the inconvenience, but the issue is already resolved in latest master.

Try:

devtools::install_github("quanteda/spacyr")
amatsuo commented 6 years ago

Just a quick note: this issue is resolved in the latest CRAN version (v0.9.91). If you get this pip issue, please update the package