Pip: Unable to upgrade pip or install packages

Created on 16 Apr 2018  路  11Comments  路  Source: pypa/pip

  • Pip version: pip 8.0.3
  • Python version: 3.4.3
  • Operating system: OS 10.13

Description:

I was trying to install beautifulSoup4, but I keep running into an error claiming there is a problem with the ssl certificate.

$ pip install beautifulsoup4
Could not fetch URL https://pypi.python.org/simple/beautifulsoup4/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:600) - skipping
  Could not find a version that satisfies the requirement beautifulsoup4 (from versions: )
No matching distribution found for beautifulsoup4

I saw a few others having a similar issue that they were able to work around by nameing pypi.python.org as a trusted host. I tried that, but to no successful.

$ pip install --trusted-host pypi.python.org beautifulsoup4
Collecting beautifulsoup4
  Could not fetch URL https://pypi.python.org/simple/beautifulsoup4/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:600) - skipping
  Could not find a version that satisfies the requirement beautifulsoup4 (from versions: )
No matching distribution found for beautifulsoup4

I also found I am unable to upgrade pip. When trying to upgrade pip, I see that requirements are already up to date, although when running pip --version I see that I'm a few versions behind.

$ pip install -U pip
Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:600) - skipping
Requirement already up-to-date: pip in /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages

$ pip --version
pip 8.0.3 from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (python 3.4)

Anyone experience similar issues? Any suggestions?

auto-locked support

Most helpful comment

Upgrade pip3 using.

curl https://bootstrap.pypa.io/get-pip.py | python3

Instead of pip install -U pip

For pip2
pip2 install --upgrade pip

All 11 comments

What happens when you add the -vvv verbosity flag to get more detailed error messages? I wonder whether https://mail.python.org/pipermail/python-announce-list/2018-April/011885.html is affecting you.

@brainwane Results of adding -vvv. It's definitely failing when trying to make a connection to pypi.python.org

$ pip install -U pip -vvv
1 location(s) to search for versions of pip:
* https://pypi.python.org/simple/pip/
Getting page https://pypi.python.org/simple/pip/
Looking up "https://pypi.python.org/simple/pip/" in the cache
No cache entry available
Starting new HTTPS connection (1): pypi.python.org
Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:600) - skipping
Installed version (8.0.3) is most up-to-date (past versions: none)
Requirement already up-to-date: pip in /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages
Cleaning up...
Looking up "https://pypi.python.org/pypi/pip/json" in the cache
No cache entry available
Starting new HTTPS connection (1): pypi.python.org
There was an error checking the latest version of pip
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 559, in urlopen
    body=body, headers=headers)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 345, in _make_request
    self._validate_conn(conn)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 784, in _validate_conn
    conn.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connection.py", line 252, in connect
    ssl_version=resolved_ssl_version)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py", line 305, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ssl.py", line 365, in wrap_socket
    _context=self)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ssl.py", line 583, in __init__
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ssl.py", line 810, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/requests/adapters.py", line 376, in send
    timeout=timeout
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 588, in urlopen
    raise SSLError(e)
pip._vendor.requests.packages.urllib3.exceptions.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/utils/outdated.py", line 126, in pip_version_check
    headers={"Accept": "application/json"},
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 480, in get
    return self.request('GET', url, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/download.py", line 377, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/cachecontrol/adapter.py", line 46, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/requests/adapters.py", line 447, in send
    raise SSLError(e, request=request)
pip._vendor.requests.exceptions.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:600)

I was right. :) You're affected by the TLS 1.0/1.1 deprecation mentioned in https://mail.python.org/pipermail/python-announce-list/2018-April/011885.html . Solution: upgrade pip using the bootstrapping method described in:

https://pip.pypa.io/en/latest/installing/

@brainwane Looks like you are indeed correct. I'm using TLS 1.0.
However, I'm still running into issues upgrading. I successfully upgraded my Python version to 3.6.5. Following the bootstrapping instructions you linked, it looks like pip 10.0.0 was installed but I'm still running pip 8.0.3. Not sure how I can force pip 10.0.0

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1602k 100 1602k 0 0 3660k 0 --:--:-- --:--:-- --:--:-- 3667k $ python get-pip.py Collecting pip Downloading https://files.pythonhosted.org/packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py2.py3-none-any.whl (1.3MB) 100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 1.3MB 4.0MB/s matplotlib 1.3.1 requires nose, which is not installed. matplotlib 1.3.1 requires tornado, which is not installed. Installing collected packages: pip Found existing installation: pip 10.0.0 Uninstalling pip-10.0.0: Successfully installed pip-10.0.0 $ pip --version pip 8.0.3 from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (python 3.4)

Upgrade pip3 using.

curl https://bootstrap.pypa.io/get-pip.py | python3

Instead of pip install -U pip

For pip2
pip2 install --upgrade pip

@jackton1 The first suggestion did the trick. Many thanks!

Great. :) If you think the problem's solved, please close the issue @ampersamd.

Thanks @brainwane and @jackton1! :)

Hi folks,

I met the similar issue while trying to install opencv-python, and others package install success.

  • OS: Windows10
  • python: 3.7.0
  • pip: 10.0.1

The package can be found via pip search, and the install error message is:

Could not find a version that satisfies the requirement opencv-python==3.4.1.15 (from versions: )
No matching distribution found for opencv-python==3.4.1.15

adding the -vvv output is:

Collecting opencv-python==3.4.1.15
  1 location(s) to search for versions of opencv-python:
  * https://pypi.org/simple/opencv-python/
  Getting page https://pypi.org/simple/opencv-python/
  Looking up "https://pypi.org/simple/opencv-python/" in the cache
  Current age based on date: 57
  Freshness lifetime from max-age: 600
  Freshness lifetime from request max-age: 600
  The response is "fresh", returning cached response
  600 > 57
  Analyzing links from page https://pypi.org/simple/opencv-python/
    Skipping link https://files.pythonhosted.org/packages/e3/09/6d175ca54a4fd3072b4575e971140ced19a96fffe75828358c72b29c6147/opencv_python-3.1.0.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl#sha256=d316c9660ed5f2625a69425c52d391dedd4df3fef11f2ed50dcce97f3e567827 (from https://pypi.org/simple/opencv-python/); it is not compatible with this Python
    ............    
    Skipping link https://files.pythonhosted.org/packages/88/ef/777a311a9044fa7b5760848e88b3bbf68d3e535a5a4b813cde839195af51/opencv_python-3.4.1.15-cp36-cp36m-win32.whl#sha256=76c732905bd84b84d7c6d8b924471a54d02088e649e006ad8abda4b630a5de93 (from https://pypi.org/simple/opencv-python/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/2b/31/cc5cf31258dc2cbb50dd1b046164add33804eab7af036d86aa68d45c7f6c/opencv_python-3.4.1.15-cp36-cp36m-win_amd64.whl#sha256=2cea809afe32cdccf97d66b131afc0fed80076244fb77b68ad9bf016d9cdc261 (from https://pypi.org/simple/opencv-python/); it is not compatible with this Python
Cleaning up...
Exception information:
Traceback (most recent call last):
  File "d:\program files\python\python37\lib\site-packages\pip\_internal\basecommand.py", line 228, in main
    status = self.run(options, args)
  File "d:\program files\python\python37\lib\site-packages\pip\_internal\commands\install.py", line 291, in run
    resolver.resolve(requirement_set)
  File "d:\program files\python\python37\lib\site-packages\pip\_internal\resolve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
  File "d:\program files\python\python37\lib\site-packages\pip\_internal\resolve.py", line 257, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "d:\program files\python\python37\lib\site-packages\pip\_internal\resolve.py", line 210, in _get_abstract_dist_for
    self.require_hashes
  File "d:\program files\python\python37\lib\site-packages\pip\_internal\operations\prepare.py", line 245, in prepare_linked_requirement
    req.populate_link(finder, upgrade_allowed, require_hashes)
  File "d:\program files\python\python37\lib\site-packages\pip\_internal\req\req_install.py", line 307, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "d:\program files\python\python37\lib\site-packages\pip\_internal\index.py", line 533, in find_requirement
    'No matching distribution found for %s' % req
pip._internal.exceptions.DistributionNotFound: No matching distribution found for opencv-python==3.4.1.15

Anyone have any suggestions?

Yeah. It seems that OpenCV hasn't released any wheels for Python 3.7 yet, hence the error message.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings