I am using below setup
poetry: 1.2.2
pyenv: 2.3.5-3-g0726e02e
python: 3.11.0
scikit-learn: 1.1.2
I am trying to install scikit-learn using command:
**poetry add scikit-learn **
But I am getting error as below:
Preparing metadata (pyproject.toml): still running...
Preparing metadata (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [273 lines of output]
Partial import of sklearn during the build process.
setup.py:128: DeprecationWarning:
`numpy.distutils` is deprecated since NumPy 1.23.0, as a result
of the deprecation of `distutils` itself. It will be removed for
Python >= 3.12. For older Python versions it will remain present.
It is recommended to use `setuptools < 60.0` for those Python versions.
For more details, see:
https://numpy.org/devdocs/reference/distutils_status_migration.html
....
....
....
self.finalize_unix()
File "/tmp/pip-build-env-go8f9tm1/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/install.py", line 498, in finalize_unix
self.select_scheme("posix_prefix")
File "/tmp/pip-build-env-go8f9tm1/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/install.py", line 528, in select_scheme
return self._select_scheme(resolved)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-go8f9tm1/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/install.py", line 537, in _select_scheme
setattr(self, attrname, scheme[key])
~~~~~~^^^^^
KeyError: 'headers'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
what I am missing?
As in error message suggests to try with setuptools < 60.0.0
I tried poetry run pip install setuptools==59.8.0
while doing poetry add scikit-learn, it auto upgrades setuptools to version 65.0 something and fails with error.
Although, using above setup(excluding scikit-learn) I am able to successfully install numpy, pandas, scipy etc without any need to downgrade the setuptools version.
This should install scikit-learn:
pip install -U sklearn
It worked on my system with Python 3.11.
I got it via: pip3 install -U scikit-learn
Related
I have build a flask app for image segmentation using pretrained model from Detectron2,locally I can run the app without any issue/errors, I am trying to deploy same app on Azure App Service, the problems seems to be installing Detectron2 framework, detectron2 require torch python package to get installed correctly, is there any workaround to install both torch and detectron using requirement.txt
this is the content of requiremnet.txt
firebase==3.0.1
firebase-admin==5.0.3
Flask==2.0.2
imutils==0.5.4
matplotlib==3.3.4
numpy==1.21.6
opencv-python==4.5.3.56
pandas==1.1.5
Pillow==8.4.0
scikit-image==0.17.2
scikit-learn==0.21.3
webcolors==1.11.1
Werkzeug==2.0.2
gspread==5.4.0
oauth2client==4.1.3
opencv-contrib-python==4.5.3.56
tensorflow
torch
# Detectron detectron2
git+https://github.com/facebookresearch/detectron2.git
and here is the error I am getting from Azure Logs
python: 3.7.15
Warning: An outdated version of python was detected (3.7.15). Consider updating.\nVersions supported by Oryx: https://github.com/microsoft/Oryx
Python Version: /tmp/oryx/platforms/python/3.7.15/bin/python3.7
Creating directory for command manifest file if it does not exist
Removing existing manifest file
Python Virtual Environment: antenv
Creating virtual environment...
Activating virtual environment...
Running pip install...
[05:40:09+0000] Collecting git+https://github.com/facebookresearch/detectron2.git (from -r requirements.txt (line 20))
[05:40:09+0000] Cloning https://github.com/facebookresearch/detectron2.git to /tmp/pip-req-build-3_w8g61y
Running command git clone --quiet https://github.com/facebookresearch/detectron2.git /tmp/pip-req-build-3_w8g61y
[05:40:12+0000] Resolved https://github.com/facebookresearch/detectron2.git to commit 1523b3e9929a06d798871eb9afc4c9f770743baf
[05:40:12+0000] Preparing metadata (setup.py): started
[05:40:12+0000] 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
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 36, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-req-build-3_w8g61y/setup.py", line 10, in <module>
import torch
ModuleNotFoundError: No module named 'torch'
[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.
I have already tried using different python version, please suggest some workaround or any corrections I need to do.
here I have work around where you manually install some package and then use the requirements.txt file. The reason for this is the module not found error.
Before we begin we should first install the gcc , g++ and git this is done using the following command
apt-get install <Package name>
Now we can install the python packages (I have created venv before we start installing) Independently we can install two i.e. torch & pycocotools
Now we can run the requirements.txt with all the remaining packages.
My requirments.txt:
firebase==3.0.1
firebase-admin==5.0.3
Flask==2.0.2
imutils==0.5.4
matplotlib==3.3.4
numpy==1.21.6
pandas==1.5.3
Pillow==9.4.0
scikit-image==0.19.3
scikit-learn==1.2.1
webcolors== 1.12
Werkzeug==2.2.3
gspread==5.7.2
oauth2client==4.1.3
opencv-contrib-python==4.7.0.68
tensorflow
opencv-python==4.7.0.68
# Detectron detectron2
git+https://github.com/facebookresearch/detectron2.git
Output should like this alfter install all the packages:
whenever I try to install turicreate module on wsl it's showing an error like this
`Collecting turicreate
Using cached turicreate-6.4.tar.gz (1.9 kB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for turicreate, since package 'wheel' is not installed.
Installing collected packages: turicreate
Running setup.py install for turicreate ... error
error: subprocess-exited-with-error
× Running setup.py install for turicreate did not run successfully.
│ exit code: 1
╰─> [30 lines of output]
running install
/root/turitest/venv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
==================================================================================
TURICREATE ERROR
If you see this message, pip install did not find an available binary package
for your system.
Supported Platforms:
* macOS 10.12+ x86_64.
* Linux x86_64 (including WSL on Windows 10).
Support Python Versions:
* 2.7
* 3.5
* 3.6
* 3.7
* 3.8
Another possible cause of this error is an outdated pip version. Try:
`pip install -U pip`
==================================================================================
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> turicreate
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
`
pip version - 22.0.2
python3.10 (I guess this maybe the problem, but I'm not sure)
windows10 OS
can someone help me to install turicreate...
I tried updating and upgrading pip versions, tried in python 2.7 and python3.10 but still got the same error.
I also tried this command,
python3 -m pip3 install -U pip
this returned
No module named pip3
I am trying to install sklearn. I have tried all the commands of this post: ImportError: No module named sklearn (Python) but none of these works.
I get this:
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: You are using pip version 22.0.4; however, version 22.1.2 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m pip install --upgrade pip' command.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: You are using pip version 22.0.4; however, version 22.1.2 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m pip install --upgrade pip' command.
What can I do?
Hello im having a real hard time installing darts in Python
Thanks in advance.
Running setup.py install for llvmlite ... error
error: subprocess-exited-with-error
× Running setup.py install for llvmlite did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
running install
/opt/homebrew/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
got version from file /private/var/folders/m4/g2pdxhsd7dn2652ll8d9sz3c0000gn/T/pip-install-fza_0yk5/llvmlite_dc59eabdee5b435d8bd514c51e5c47db/llvmlite/_version.py {'version': '0.38.0', 'full': 'f0365b91ce1e1f74c68785c6d0067f32f89857d9'}
running build_ext
/opt/homebrew/opt/python#3.9/bin/python3.9 /private/var/folders/m4/g2pdxhsd7dn2652ll8d9sz3c0000gn/T/pip-install-fza_0yk5/llvmlite_dc59eabdee5b435d8bd514c51e5c47db/ffi/build.py
LLVM version... Traceback (most recent call last):
File "/private/var/folders/m4/g2pdxhsd7dn2652ll8d9sz3c0000gn/T/pip-install-fza_0yk5/llvmlite_dc59eabdee5b435d8bd514c51e5c47db/ffi/build.py", line 220, in
main()
File "/private/var/folders/m4/g2pdxhsd7dn2652ll8d9sz3c0000gn/T/pip-install-fza_0yk5/llvmlite_dc59eabdee5b435d8bd514c51e5c47db/ffi/build.py", line 214, in main
main_posix('osx', '.dylib')
File "/private/var/folders/m4/g2pdxhsd7dn2652ll8d9sz3c0000gn/T/pip-install-fza_0yk5/llvmlite_dc59eabdee5b435d8bd514c51e5c47db/ffi/build.py", line 134, in main_posix
raise RuntimeError(msg) from None
RuntimeError: Could not find a llvm-config binary. There are a number of reasons this could occur, please see: https://llvmlite.readthedocs.io/en/latest/admin-guide/install.html#using-pip for help.
error: command '/opt/homebrew/opt/python#3.9/bin/python3.9' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> llvmlite
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Please try to install darts in mac version 12.5.1 as follows:
My python version is different. But hoping this procedure works for you:
For your information below is my requirement.txt:
protobuf==3.20.1
python-dateutil==2.8.2
elasticsearch==7.13.0
elasticsearch-dsl==7.4.0
Flask==1.1.4
flask_restplus==0.13.0
Werkzeug==0.16.1
python-json-logger==2.0.2
ecs-logging==2.0.0
omegaconf==2.1.1
mock==4.0.3
nltk==3.6.7
PyJWT==2.4.0
pytest==6.2.5
requests==2.27.1
scikit-learn==1.0.2
pandas==1.3.5
pandasql==0.7.3
xlrd==2.0.1
colorlog==6.6.0
darts==0.15.0
psutil==5.9.1
decorator==5.1.1
zulu==2.0.0
But for dart installation i was facing issue. I solved the issue by manually installing packages as follows:-
% python --version
Python 3.10.6
% pip install CMAKE
% pip install setuptools
% pip3 install gensim
% brew install lightgbm
% brew install cmake
% brew install libomp
% pip install httpstan
% pip install lightgbm
% pip install ipython
% pip install google-auth-oauthlib
% pip install filterpy
% pip install cmdstanpy
% pip install tensorboard
% pip install prophet
% pip install pmdarima
% pip install darts
% pip list | grep darts
darts 0.21.0
Ive recently bought a MacBook Pro and was setting it up for some python and Django programming but I ended up having problems installing psycopg2, I've tried several things already and none of those worked for me, here left the error,
Collecting psycopg2
Using cached psycopg2-2.9.3.tar.gz (380 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
running egg_info
creating /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info
writing /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/PKG-INFO
writing dependency_links to /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/dependency_links.txt
writing top-level names to /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/top_level.txt
writing manifest file '/private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/SOURCES.txt'
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
[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.
It shows it is not a problem with pip but with setup.py but can not find anything,
any help would be welcomed
Thanks
As Alex mentioned, it is PostGreSQL being not installed on your system that throws up the error
Install PostGreSQL and it will all work fine
Try this
❯ brew install postgresql
# If you open a new terminal tab you will see that pg_config is available
❯ export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include"
❯ export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib -L${HOME}/.pyenv/versions/3.8.10/lib"
❯ python -V
Python 3.9.13
❯ pip install psycopg2-binary==2.8.6```
Try using the following command:
pip3 install psycopg2-binary
Late, but I just had this problem and nothing I was finding was fixing it. I was trying to install the requirements.txt for an ongoing project on a new Mac. Eventually I remembered it's a postgresql package and I hadn't installed postgresql yet. As soon as I installed postgresql and tried installing psycopg2 again, it worked fine with no errors.