Pip install returning a ValueError
Question:
I recently tried to install a library using Pip, and I received this error message. I am unable to install any packages, as the same error message keeps popping up.
I notice this problem in both my main enviroment, and my venv Virtual Environment.
Any help will be much appreciated.
WARNING: Ignoring invalid distribution -illow (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: Ignoring invalid distribution -aleido (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: Ignoring invalid distribution -illow (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: Ignoring invalid distribution -aleido (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
ERROR: Exception:
Traceback (most recent call last):
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_internalclibase_command.py", line 167, in exc_logging_wrapper
status = run_func(*args)
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_internalclireq_command.py", line 205, in wrapper
return func(self, options, args)
...
resp = self.send(prep, **send_kwargs)
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorrequestssessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorcachecontroladapter.py", line 57, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorrequestsadapters.py", line 440, in send
resp = conn.urlopen(
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorurllib3connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorurllib3connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorurllib3connectionpool.py", line 1040, in _validate_conn
conn.connect()
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorurllib3connection.py", line 401, in connect
context.verify_mode = resolve_cert_reqs(self.cert_reqs)
File "c:usersbrdwooappdatalocalprogramspythonpython39libssl.py", line 720, in verify_mode
super(SSLContext, SSLContext).verify_mode.__set__(self, value)
ValueError: Cannot set verify_mode to CERT_NONE when check_hostname is enabled.
WARNING: Ignoring invalid distribution -illow (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: Ignoring invalid distribution -aleido (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: Ignoring invalid distribution -illow (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: Ignoring invalid distribution -aleido (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: There was an error checking the latest version of pip.
Answers:
This occurs due to files names with the ‘~’ prefix in site-packages. Please remove those files / folders. It will solve your problem.
I was able to fix the problem by hard-coding in a 1, instead of having CERT_NONE being passed to verify_mode.
The error message gave me the location of the code:
File "C:UsersnameAppDataLocalProgramsPythonPython310libssl.py", line 738, in verify_mode
super(SSLContext, SSLContext).verify_mode.__set__(self, 0)
ValueError: Cannot set verify_mode to CERT_NONE when check_hostname is enabled.
I swapped the variable value -> 1
@verify_mode.setter
def verify_mode(self, value):
super(SSLContext, SSLContext).verify_mode.__set__(self, 1)
Do you have pip-system-certs installed? Try uninstalling it, and see if your problem goes away. It did for me (but I am unsure of the consequences in a python 3.10 environment)
[WARNING: Ignoring invalid distribution -ip (~libsite-packages)e][1]
Hello, I had a similar problem where Visual Studio Code couldn’t find installed libraries. The problem occurred after updating the Python version. What I did is shown in the steps 1 and 2 in the picture – I selected the Python version from the dropdown in the upper right corner, and in step 2, I switched to an older, working version. I hope this helps someone…
[1]: https://i.stack.imgur.com/zDjr4.jpg
I recently tried to install a library using Pip, and I received this error message. I am unable to install any packages, as the same error message keeps popping up.
I notice this problem in both my main enviroment, and my venv Virtual Environment.
Any help will be much appreciated.
WARNING: Ignoring invalid distribution -illow (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: Ignoring invalid distribution -aleido (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: Ignoring invalid distribution -illow (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: Ignoring invalid distribution -aleido (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
ERROR: Exception:
Traceback (most recent call last):
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_internalclibase_command.py", line 167, in exc_logging_wrapper
status = run_func(*args)
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_internalclireq_command.py", line 205, in wrapper
return func(self, options, args)
...
resp = self.send(prep, **send_kwargs)
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorrequestssessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorcachecontroladapter.py", line 57, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorrequestsadapters.py", line 440, in send
resp = conn.urlopen(
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorurllib3connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorurllib3connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorurllib3connectionpool.py", line 1040, in _validate_conn
conn.connect()
File "c:usersbrdwooappdatalocalprogramspythonpython39libsite-packagespip_vendorurllib3connection.py", line 401, in connect
context.verify_mode = resolve_cert_reqs(self.cert_reqs)
File "c:usersbrdwooappdatalocalprogramspythonpython39libssl.py", line 720, in verify_mode
super(SSLContext, SSLContext).verify_mode.__set__(self, value)
ValueError: Cannot set verify_mode to CERT_NONE when check_hostname is enabled.
WARNING: Ignoring invalid distribution -illow (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: Ignoring invalid distribution -aleido (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: Ignoring invalid distribution -illow (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: Ignoring invalid distribution -aleido (c:usersbrdwooappdatalocalprogramspythonpython39libsite-packages)
WARNING: There was an error checking the latest version of pip.
This occurs due to files names with the ‘~’ prefix in site-packages. Please remove those files / folders. It will solve your problem.
I was able to fix the problem by hard-coding in a 1, instead of having CERT_NONE being passed to verify_mode.
The error message gave me the location of the code:
File "C:UsersnameAppDataLocalProgramsPythonPython310libssl.py", line 738, in verify_mode
super(SSLContext, SSLContext).verify_mode.__set__(self, 0)
ValueError: Cannot set verify_mode to CERT_NONE when check_hostname is enabled.
I swapped the variable value -> 1
@verify_mode.setter
def verify_mode(self, value):
super(SSLContext, SSLContext).verify_mode.__set__(self, 1)
Do you have pip-system-certs installed? Try uninstalling it, and see if your problem goes away. It did for me (but I am unsure of the consequences in a python 3.10 environment)
[WARNING: Ignoring invalid distribution -ip (~libsite-packages)e][1]
Hello, I had a similar problem where Visual Studio Code couldn’t find installed libraries. The problem occurred after updating the Python version. What I did is shown in the steps 1 and 2 in the picture – I selected the Python version from the dropdown in the upper right corner, and in step 2, I switched to an older, working version. I hope this helps someone…
[1]: https://i.stack.imgur.com/zDjr4.jpg