Reticulate: Installing sklearn doesn't work with either py_install or conda_install

Created on 25 Oct 2019  路  6Comments  路  Source: rstudio/reticulate

py_install and conda_install worked for pandas but for sklearn, it throws me an error. The whole error doesn't show up in reprex which I've copied and pasted from the console directly.

library(reticulate)
py_install("sklearn")
#> Error: Error 1 occurred installing packages into conda environment r-reticulate

conda_install("r-reticulate", "sklearn")
#> Error: Error 1 occurred installing packages into conda environment r-reticulate

sessionInfo()
#> R version 3.6.1 (2019-07-05)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 16299)
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=English_United States.1252 
#> [2] LC_CTYPE=English_United States.1252   
#> [3] LC_MONETARY=English_United States.1252
#> [4] LC_NUMERIC=C                          
#> [5] LC_TIME=English_United States.1252    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] reticulate_1.13.0-9003
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.2      digest_0.6.21   rappdirs_0.3.1  jsonlite_1.6   
#>  [5] magrittr_1.5    evaluate_0.14   highr_0.8       rlang_0.4.0    
#>  [9] stringi_1.4.3   rmarkdown_1.16  tools_3.6.1     stringr_1.4.0  
#> [13] xfun_0.10       yaml_2.2.0      compiler_3.6.1  htmltools_0.4.0
#> [17] knitr_1.25

Error copied from console

Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... failed with current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... failed

PackagesNotFoundError: The following packages are not available from current channels:

  - sklearn

Current channels:

  - https://conda.anaconda.org/conda-forge/win-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

Most helpful comment

I don't know if it can help, but I solved using:

py_install("scikit-learn")

All 6 comments

You probably want py_install(pip = TRUE).

I tried it - a different error now below

C:\Users\dilsher.dhillon\OneDrive - Shell\Projects\ptx-data-science-shallow-hazard>conda.bat activate C:/Users/dilsher.dhillon/AppData/Local/Continuum/miniconda3/envs/r-reticulate Collecting sklearn Collecting scikit-learn (from sklearn) Using cached https://files.pythonhosted.org/packages/d6/9e/6a42486ffa64711fb868e5d4a9167153417e7414c3d8d3e0d627cf391e1e/scikit_learn-0.21.3-cp37-cp37m-win_amd64.whl Collecting scipy>=0.17.0 (from scikit-learn->sklearn) Using cached https://files.pythonhosted.org/packages/50/eb/defa40367863304e1ef01c6572584c411446a5f29bdd9dc90f91509e9144/scipy-1.3.1-cp37-cp37m-win_amd64.whl Collecting numpy>=1.11.0 (from scikit-learn->sklearn) Using cached https://files.pythonhosted.org/packages/e9/dd/a177f27765b1e5f94fa879cbeef61f8807086371d0b6aa232b836d38b78b/numpy-1.17.3-cp37-cp37m-win_amd64.whl Collecting joblib>=0.11 (from scikit-learn->sklearn) Using cached https://files.pythonhosted.org/packages/8f/42/155696f85f344c066e17af287359c9786b436b1bf86029bb3411283274f3/joblib-0.14.0-py2.py3-none-any.whl Installing collected packages: numpy, scipy, joblib, scikit-learn, sklearn ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\\Users\\dilsher.dhillon\\AppData\\Local\\Continuum\\miniconda3\\envs\\r-reticulate\\Lib\\site-packages\\numpy\\core\\_multiarray_tests.cp37-win_amd64.pyd' Consider using the `--user` option or check the permissions.

Is there a way I can add the --user argument to the py_install ?

I wonder if that error is occurring because py_install() is trying to reinstall numpy after it's already been loaded?

I'll think about how we could allow for addition arguments to be passed during the installation process.

I don't know if it can help, but I solved using:

py_install("scikit-learn")

I don't know if it can help, but I solved using:

py_install("scikit-learn")

Great !! It works!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jjallaire picture jjallaire  路  9Comments

dougmet picture dougmet  路  6Comments

ruthkr picture ruthkr  路  5Comments

herboratory picture herboratory  路  6Comments

berkorbay picture berkorbay  路  4Comments