Open dshelldhillon opened 4 years ago
You probably want py_install(pip = TRUE).
I tried it - a different error now below
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!
I also tried all your tricks but I still cannot install sklearn. I'm using R 4.3.1 python 3.12.1 on a Mac OS Ventura 13.5 (not sure the mac is a problem). I'm a really new user of python.
@ebalmas what is the error you are seeing?
Running py_install("scikit-learn")
locally succeeds without error for me.
Collecting sklearn Using cached sklearn-0.0.post12.tar.gz (2.6 kB) Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'error' error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [15 lines of output] The 'sklearn' PyPI package is deprecated, use 'scikit-learn' rather than 'sklearn' for pip commands.
Here is how to fix this error in the main use cases:
- use 'pip install scikit-learn' rather than 'pip install sklearn'
- replace 'sklearn' by 'scikit-learn' in your pip requirements files
(requirements.txt, setup.py, setup.cfg, Pipfile, etc ...)
- if the 'sklearn' package is used by one of your dependencies,
it would be great if you take some time to track which package uses
'sklearn' instead of 'scikit-learn' and report it to their issue tracker
- as a last resort, set the environment variable
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True to avoid this error
More information is available at
https://github.com/scikit-learn/sklearn-pypi-package
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
× Encountered error while generating package metadata. ╰─> See above for output.
note: This is an issue with the package mentioned above, not pip. hint: See above for details. Error: Error installing package(s): 'sklearn'
I also tried to install py_install("scikit-learn") and works, but once I try to run a python code that has it as a dependency, it asks again for 'sklearn'
once I try to run a python code that has it as a dependency, it asks again for 'sklearn'
It seems you have some legacy code that either needs to be updated, or you need to roll-back your environment to what the legacy code requires. You'll probably need an older version of Python, and hopefully you'll have a requirements.txt
file.
You can point pip at the posit package manager with a snapshot date, which will install the versions of packages that were available in pypi on a given date. E.g.,
reticulate::py_install(
"sklearn", pip = TRUE,
pip_options = "--index-url https://packagemanager.posit.co/pypi/2023-08-01/simple"
)
https://packagemanager.posit.co/client/#/repos/pypi/setup?snapshot=2024-01-29
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.
Error copied from console