Why i get errors while Installing Python modules? - python

i am using:
Python 3.10.1
Pip 21.2.4
Python Project in an virtual enviroment
My Problem:
Everytime i try to install any package (for instance opencv) i get the following error:
(einstieg) C:\Users\User\Python\pyproj>pip install python-ldap
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by
'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)'))': /simple/python-ldap/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by
'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)'))': /simple/python-ldap/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by
'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)'))': /simple/python-ldap/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by
'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)'))': /simple/python-ldap/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by
'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)'))': /simple/python-ldap/
Could not fetch URL https://pypi.org/simple/python-ldap/:
There was a problem confirming the ssl certificate:
HTTPSConnectionPool(host='pypi.org', port=443):
Max retries exceeded with url: /simple/python-ldap/
(Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)'))) - skipping
ERROR: Could not find a version that satisfies the requirement python-ldap (from versions: none)
ERROR: No matching distribution found for python-ldap
Could not fetch URL https://pypi.org/simple/pip/:
There was a problem confirming the ssl certificate:
HTTPSConnectionPool(host='pypi.org', port=443):
Max retries exceeded with url: /simple/pip/
(Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)'))) - skipping
I tried some of the trusted hosts hints i found but nothing worked.
my be somebody knows where my problem come from?

This issue is related to SSL Certificate. Try pasting this in CMD:
python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip
If that doesn't do the work, try this:
pip install requests==2.18.4 --user --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org
If you have installed Fiddler earlier, uninstall it, that might be the cause of the problem.
And lastly if none of this works, then you need to directly download the files from wheel. This means that first you'll download the package on your PC, then write pip install your-package.whl.
You can find OpenCV and other package's .whl files online easily.

Related

Could not fetch URL https://pypi.org/simple/tensorflow-gpu/: There was a problem confirming the ssl certificate

I'm using ubuntu.
I want to install tensorflow-gpu==1.15.0
python3.7 -m pip install tensorflow-gpu==1.15.0
I got this erro:
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tensorflow-gpu/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tensorflow-gpu/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tensorflow-gpu/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tensorflow-gpu/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tensorflow-gpu/
Could not fetch URL https://pypi.org/simple/tensorflow-gpu/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/tensorflow-gpu/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement tensorflow-gpu==1.15.0 (from versions: none)
ERROR: No matching distribution found for tensorflow-gpu==1.15.0
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
also I doing but this command:
python3.7 -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org tensorflow-gpu==1.15.0
but I got the same error.
Update the file below with this:
[global]
trusted-host = pypi.python.org
pypi.org
files.pythonhosted.org
file location
MacOS - $HOME/Library/Application Support/pip/pip.conf
Unix - $HOME/.config/pip/pip.conf
Windows - %APPDATA%\pip\pip.ini

Issues Install Django in my Current python -V Python 3.9.6

I have an issue while installing Django.
ERROR: No matching distribution found for django
C:\Users\rajesh-kumar>python -V
Python 3.9.6
C:\Users\rajesh-kumar>pip -V
pip 21.1.3 from c:\users\rajesh-kumar\appdata\local\programs\python\python39\lib\site-packages\pip (python 3.9)
C:\Users\rajesh-kumar>pip install django
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error (_ssl.c:1129)'))': /simple/django/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error (_ssl.c:1129)'))': /simple/django/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error (_ssl.c:1129)'))': /simple/django/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error (_ssl.c:1129)'))': /simple/django/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error (_ssl.c:1129)'))': /simple/django/
Could not fetch URL https://pypi.org/simple/django/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/django/ (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error (_ssl.c:1129)'))) - skipping
ERROR: Could not find a version that satisfies the requirement django (from versions: none)
ERROR: No matching distribution found for django
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error (_ssl.c:1129)'))) - skipping
Try this
pip3 install virtualenv
After that
virtualenv venv
Then activate your environment
source venv/bin/activate
And now you can install Django, I think this is better way and safe, rather than install django in a global system.
pip install django

Error while installing matplotlib using pip install

I installed python, jupyter notebook, numpy and pandas using pip instll on the office system without any problem but am unable to install Matplotlib. I get the following error:
pip install matplotlib
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)'))': /simple/matplotlib/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)'))': /simple/matplotlib/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)'))': /simple/matplotlib/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)'))': /simple/matplotlib/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)'))': /simple/matplotlib/
Could not fetch URL https://pypi.org/simple/matplotlib/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/matplotlib/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)'))) - skipping
ERROR: Could not find a version that satisfies the requirement matplotlib
ERROR: No matching distribution found for matplotlib
I also tried :
python -m pip install -U pip
python -m pip install -U matplotlib
And:
!{sys.executable} -m pip install matplotlib
raise error:
!{sys.executable} -m pip install matplotlib '!{sys.executable}' is not recognized as an internal or external command, operable program or batch file
I don't know what the problem is or how to fix it, please help me out.
. .

ERROR : Could not find a version that satisfies the requirement pandas (from versions: ) No matching distribution found for pandas

I'm new to PyCharm and wanted to install pandas in my project.
So, I used the following commands(one by one because the first one didn't work) in the terminal of PyCharm to do it.
>pip install pandas
>python -m pip install pandas
I got the same errors for both of them.
ERROR :
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting pandas
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not a
vailable.")': /simple/pandas/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not a
vailable.")': /simple/pandas/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not a
vailable.")': /simple/pandas/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not a
vailable.")': /simple/pandas/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not a
vailable.")': /simple/pandas/
Could not fetch URL https://pypi.org/simple/pandas/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded w
ith url: /simple/pandas/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Could not find a version that satisfies the requirement pandas (from versions: )
No matching distribution found for pandas
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with u
rl: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
How do I install pandas now? Please help.
OS : Windows 10
Python version : Python 3.7.6
pip version : pip 19.0.3
So, my system has Anaconda installed and while creating the project, I forgot to the change the 'basic interpreter' from Conda to normal python.exe, that's why I wasn't able to install anything in it as I was using Anaconda's pip.

Can't get virtualenv working due to SSL error

I'm trying to use virtualenv on my Mac (El Capitan) but something must have changed recently, as it's no longer working, and complains about SSL problems.
It's the first time I've had to use this project in about 9 months, and in that time, I've not changed anything on my system regarding Python.
In an effort to get it working, over the past day or so I've uninstalled virtualenv, manually deleted some files (I found these instructions in a GitHub issue, but I can't find them again to provide a link, but if I remember correctly, it was just deleting broken symlinks and directories relating to virtualenv,) and then uninstalled Python via Brew, leaving me with a system that had no Python, pip, or virtualenv libraries or executables on it.
Then I ran brew install python2 to get Python installed. Then I ran pip install virtualenv which gave me the same SSL error as before. I manually downloaded virtualenv from the URL pip was trying to download it from, and then pip installed it locally using the downloaded file. This worked. However, when I then run virtualenv venv, I still get the same SSL error.
I've seen issues offering all kinds of advice, from downloading DigiCertHighAssuranceEVRootCA.pem and using it via the --cert option, creating a pip.ini file with trusted-host=files.pythonhosted.org in it, using the --trusted-host option, using a different network that isn't my company's corporate network, but none of it so far has worked for me.
I am consistently getting the following SSL error whenever I try to pip install anything, or, in this specific example, create a new virtualenv:
New python executable in /Users/apl/Projects/fdm/FDM-fordele/venv/bin/python2.7
Also creating executable in /Users/apl/Projects/fdm/FDM-fordele/venv/bin/python
Installing setuptools, pip, wheel...
Complete output from command /Users/apl/Projects/...e/venv/bin/python2.7 - setuptools pip wheel:
Looking in links: /usr/local/lib/python2.7/site-packages, /usr/local/lib/python2.7/site-packages/virtualenv_support, /usr/local/lib/python2.7/site-packages/virtualenv_support
Collecting setuptools
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /s/files.pythonhosted.org/packages/96/06/c8ee69628191285ddddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl?X-OpenDNS-Session=_0a895c9402cc904c260a26007e7f555cbe499270f445_8d79d41f_
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /s/files.pythonhosted.org/packages/96/06/c8ee69628191285ddddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl?X-OpenDNS-Session=_0a895c9402cc904c260a26007e7f555cbe499270f445_8d79d41f_
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /s/files.pythonhosted.org/packages/96/06/c8ee69628191285ddddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl?X-OpenDNS-Session=_0a895c9402cc904c260a26007e7f555cbe499270f445_8d79d41f_
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /s/files.pythonhosted.org/packages/96/06/c8ee69628191285ddddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl?X-OpenDNS-Session=_0a895c9402cc904c260a26007e7f555cbe499270f445_8d79d41f_
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /s/files.pythonhosted.org/packages/96/06/c8ee69628191285ddddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl?X-OpenDNS-Session=_0a895c9402cc904c260a26007e7f555cbe499270f445_8d79d41f_
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org.x.0a895c9402cc904c260a26007e7f555cbe49.9270f445.id.opendns.com', port=443): Max retries exceeded with url: /s/files.pythonhosted.org/packages/96/06/c8ee69628191285ddddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl?X-OpenDNS-Session=_0a895c9402cc904c260a26007e7f555cbe499270f445_8d79d41f_ (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),))
Is there some other way I can get this to work? This project cannot be deployed (using an Ansible role called ansistrano) because of this error.
EDIT:
I just tried uninstalling/removing Virtualenv, Pip and Python again, reinstalling Python, then manually installing pip with https://bootstrap.pypa.io/get-pip.py, which gives:
Collecting pip
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /s/files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl?X-OpenDNS-Session=_0cf307740aff804587084980d2ecedab4cc89270f445_80300092_
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /s/files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl?X-OpenDNS-Session=_0cf307740aff804587084980d2ecedab4cc89270f445_80300092_
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /s/files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl?X-OpenDNS-Session=_0cf307740aff804587084980d2ecedab4cc89270f445_80300092_
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /s/files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl?X-OpenDNS-Session=_0cf307740aff804587084980d2ecedab4cc89270f445_80300092_
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /s/files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl?X-OpenDNS-Session=_0cf307740aff804587084980d2ecedab4cc89270f445_80300092_
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org.x.0cf307740aff804587084980d2ecedab4cc8.9270f445.id.opendns.com', port=443): Max retries exceeded with url: /s/files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl?X-OpenDNS-Session=_0cf307740aff804587084980d2ecedab4cc89270f445_80300092_ (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),))
So it turns out that this is because the company I work for use Cisco's Umbrella DNS security system, that inserts itself in all DNS requests. This breaks SSL in Python, apparently, even though I can successfully manually download the file with curl.
By adding
151.101.1.63 files.pythonhosted.org
to my hosts file, I was able to get a system that behaved exactly as expected. Hope this helps others in the future who also are forced to go through Umbrella.

Categories

Resources