Python "Pymoo" optimization package installation fail - python

I'm trying to install the "pymoo" package in order to work on multi-objective optimization and when trying to install with the pip command: pip install pymoo I'm getting the retrying warnings:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pymoo/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pymoo/
And so on.. until the count runs out and I get the following error messages:
ERROR: Could not find a version that satisfies the requirement pymoo
ERROR: No matching distribution found for pymoo
I've tried installing by getting the code from GitHub and installing with pip install . , but it gives me the same error messages.
Is there anything I'm missing in the installation process?

Related

pip: unable to skip build dependencies for ibm-db

I'm trying to get Python's IBM DB2 package 'ibm-db' up and running, but my efforts keep failing so far. The problem is that I'm behind a corporate proxy which apparently prevents downloads of dependencies needed for package installation. The command I used is:
pip --trusted-host pypi.org --trusted-host files.pythonhosted.org install --proxy=http://<host>:<port> ibm-db
This successfully downloads the package and then tries to install some build dependencies:
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001B0F00AEE60>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/setuptools/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001B0F00AE200>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/setuptools/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001B0F00ACEB0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/setuptools/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001B0F128C070>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/setuptools/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001B0F128E9B0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/setuptools/
AFAIK, the only dependency is DB2 ODBC CLI driver. ibm-db's installation instruction says you could skip that depenedency by installing ODBC CLI manually and then setting IBM_DB_HOME env variable to its installation directory - which I did, but without success. Pip still tries to download and install the dependency. I also used the --no-deps flag to keep pip from downloading it, but again without success.
So, is there another way to forcefully prevent dependency installation or make build dependencies work behind a proxy?
Btw: I'm using Python 3.10.5 and pip 22.0.4
EDIT: The OS is Win 10, so the CLI driver has been set using control panel. Installation is local.

Pip install commands don't work until they have exhausted all timeouts, after which they work normally

Earlier today my pip started exhibiting this very strange behavior where any pip install command timouts 5 times before the download starts. This is unaffected by the --default-timeout flag. For instance, doing pip install pandas I get
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(\<pip.\_vendor.urllib3.connection.HTTPConnection object at 0x7ff4b60badc0\>, 'Connection to pypi.cogtree.com timed out. (connect timeout=1.0)')': /cogtree/simple/pandas/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(\<pip.\_vendor.urllib3.connection.HTTPConnection object at 0x7ff4b60c7040\>, 'Connection to pypi.cogtree.com timed out. (connect timeout=1.0)')': /cogtree/simple/pandas/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(\<pip.\_vendor.urllib3.connection.HTTPConnection object at 0x7ff4b60c7250\>, 'Connection to pypi.cogtree.com timed out. (connect timeout=1.0)')': /cogtree/simple/pandas/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(\<pip.\_vendor.urllib3.connection.HTTPConnection object at 0x7ff4b60c7460\>, 'Connection to pypi.cogtree.com timed out. (connect timeout=1.0)')': /cogtree/simple/pandas/
Collecting pandas
Downloading pandas-1.4.1-cp38-cp38-macosx_10_9_x86_64.whl (11.4 MB)
|████████████████████████████████| 11.4 MB 6.9 MB/s
We would get the same exact result with connect timeout=10
I'm on
pip 21.2.4,
Python 3.8.8,
macOS 11.5.1,
and this is happening inside of a anaconda 4.11.0 virtual env with only default conda packages installed.
I've tried uninstalling and reinstalling pip, and conda. I can ping pypi.org fine. I tried this only multiple different wifi. Closing and reopening the terminal did not affect it either.

Pip not getting installed

C:\Python>python get-pip.py
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000002EDF31D2AD0>, 'Connection to 10.1.1.9 timed out. (connect timeout=15)')': /simple/pip/
Screenshot of the error message
I'm trying to install pip on my windows 11. I have navigated to the directory in which Python is installed. And yet, I am constantly getting the same error again and again. I haven't configured anything yet. Please guide me through the complete procedure right from the beginning by installing python.

I can't use pip on WSL Ubuntu

If I try to download Python packages with pip, following error messages come out.
nblizz#NBLIZZ-PC:~# pip3 install flask-restful
Collecting flask-restful
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(0, 'Error'))': /simple/flask-restful/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(0, 'Error'))': /simple/flask-restful/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(0, 'Error'))': /simple/flask-restful/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(0, 'Error'))': /simple/flask-restful/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(0, 'Error'))': /simple/flask-restful/
Could not find a version that satisfies the requirement flask-restful (from versions: )
No matching distribution found for flask-restful
None of these solutions work.
Re-install pip
Re-install WSL
sudo pip3 install [package]
pip3 install [package] with root account
sudo -H pip3 install [package]
pip install --user [package]
How do I install pip packages without errors?
Update your pip: python -m pip install –upgrade pip; If its already updated proceed with any of the below two methods:
Method - I
You can download binary files from the below link
https://www.lfd.uci.edu/~gohlke/pythonlibs/
Once the desired module (.whl file) is downloaded, open the command prompt on the downloaded location (you can do that by pressing shift + right click; select open command prompt/powershell here) and type pip install your-package.whl
Method - II
Go to https://pypi.org/ and search for the desired package.
Once downloaded, copy the package in the site-packages directory manually.
There are standard locations for site-package:
Unix(pure): prefix/lib/pythonX.Y/site-packages
Unix(non-pure):exec-prefix/lib/pythonX.Y/site-packages
Windows:prefix\Lib\site-packages
To verify the download, by either of these methods, use the import statement on your console.
I use google to search: pip ProtocolError
Someone said that:
SOLVED The issue was that my dorm firewall is blocking pip (pypi.python.org). Issuing the same command at work installs python packages correctly.
see: PIP not working - proxy - Connection aborted
If this solution still not work for you, please tell more about your machine like
pip --version, pip3 --version, python3 -V, python -V, cat /etc/issue
The cause was my Kaspersky application. It blocks every pip/curl executions.
I had a similar but not identical problem with pip in WSL. (There is a diffrent error message).
$ pip3 install pytest
Collecting pytest
Cache entry deserialization failed, entry ignored
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f3b23344eb8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pytest/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f3b23a7e748>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pytest/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f3b23a7e940>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pytest/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f3b23a7e390>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pytest/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f3b23a7eb00>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/pytest/
Could not find a version that satisfies the requirement pytest (from versions: )
No matching distribution found for pytest
It turned out the WSL could't connect to any DNS server. ping 8.8.8.8 -c 1 was successful, but ping www.google.com -c 1 resulted in Temporary failure in name resolution. The reason for this was that /etc/resolv.conf was corrupted. I fixed it by replacing the corrupted content with the content below:
# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line.
8.8.8.8
4.4.4.4
(Use e.g. nano for editing: sudo nano /etc/resolv.conf). I used Google's DNS servers above. WSL should update the DNS server automatically if the first line is included. After this pip worked normally again for me.
I faced the same issue on WSL1 using conda environments. Eventually I found out that the solution is to have the same python version in conda's base environment as in the conda environment from which the pip install commands are being triggered.
sudo pip install should be avoided (even if as it seemingly solves the NewConnectionError error), as it will install packages globally and will mess up conda environments.
Two issue that typcially get overlooked for me.
Add public dns entry to /etc/resolv.conf
nameserver 8.8.8.8
This will be overwritten on next startup unless you create a /etc/wsl.conf file with the below
[network]
generateResolvConf = false
The first issue is typically only a problem if wsl and windows have a time drift.
From Powershell...
Get-Date; wsl date
If your output doesn't match give it good old reboot. Usually fixes the issue for me.
Tried all solutions, what solved the issue for me is to update the wsl by running from Windows CMD
wsl --update

how to fix pip error when install pakages?

I want to install a package on pip, but I occur this error:
C:\Users\Mina>pip install sklearn
Collecting sklearn
Retrying (Retry(total=4, connect=None, read=None, redirect=None,
status=None)) after connection broken by
'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read
timed out. (read timeout=15)",)': /simple/sklearn/
Retrying (Retry(total=3, connect=None, read=None, redirect=None,
status=None)) after connection broken by
'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read
timed out. (read timeout=15)",)': /simple/sklearn/
Retrying (Retry(total=2, connect=None, read=None, redirect=None,
status=None)) after connection broken by
'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read
timed out. (read timeout=15)",)': /simple/sklearn/
Retrying (Retry(total=1, connect=None, read=None, redirect=None,
status=None)) after connection broken by
'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read
timed out. (read timeout=15)",)': /simple/sklearn/
Retrying (Retry(total=0, connect=None, read=None, redirect=None,
status=None)) after connection broken by
'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read
timed out. (read timeout=15)",)': /simple/sklearn/
Could not find a version that satisfies the requirement sklearn (from
versions: )
No matching distribution found for sklearn
This error appears to install any packages.
Note: i don't want to install on conda.
I would be very grateful if you guide me.
Best Regards,
Mina
If you check sklearn in pypi it tells you to use scikit-learn instead.
Try with: pip install -U scikit-learn
You can download the sourcecode for sklearn package from sklearn git. Download the appropriate version.
After downloading run python setup.py install to install the package

Categories

Resources