Virtualenv: pip install on macOS venv returns SSL CERTIFICATE_VERIFY_FAILED

Created on 11 Oct 2016  ·  3Comments  ·  Source: pypa/virtualenv

Using virtualenv 15.0.3, python 2.7.12, pip 8.1.2, wheel 0.30.0.a0, and setuptools 18.5.

Note: If I try installing _without_ a venv it works, no SSL issues. Hence I wanted to check here in case there might be an issue related to virtualenv.

$ virtualenv tester
Installing setuptools, pip, wheel...done.
$ . tester/bin/activate
(tester) $ cd PROJECT
(tester) $ pip install -e .
Obtaining file:///Users/jdandrea/projects/MyProject
    Complete output from command python setup.py egg_info:
    Download error on https://pypi.python.org/simple/pbr/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
    Couldn't find index page for 'pbr' (maybe misspelled?)
    Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
    No local packages or working download links found for pbr>=1.8
    Traceback (most recent call last):
    ......

See also: The full traceback.

virtualenv 14.0.6 reportedly solved an SSL issue regarding certs. Maybe this is a different/new issue? Unsure.

Most helpful comment

Interesting. I just discovered that, if I first install pbr manually within the venv, pip install -e . works without any SSL complaints.

I double checked this with a brand new venv:

# go to project directory
$ pip install -e .
Obtaining file:///Users/jdandrea/projects/myproject
    Complete output from command python setup.py egg_info:
    Download error on https://pypi.python.org/simple/pbr/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
    Couldn't find index page for 'pbr' (maybe misspelled?)
    Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
    No local packages or working download links found for pbr>=1.8
    Traceback (most recent call last):
    ......
$ pip install pbr>=1.8
$ pip list | grep pbr
pbr (1.10.0)
$ pip install -e
# everything installs, zero errors

I noticed everything was coming from cache though, so I recreated the venv and tried once more, this time using --no-cache-dir.

The install still failed unless I installed pbr @manually as a first step:

$ pip install --no-cache-dir 'pbr>=1.8'
Collecting pbr>=1.8
  Downloading pbr-1.10.0-py2.py3-none-any.whl (96kB)
  ......
Installing collected packages: pbr
Successfully installed pbr-1.10.0
$ pip install --no-cache-dir -e .
# everything installs, zero errors

All 3 comments

Interesting. I just discovered that, if I first install pbr manually within the venv, pip install -e . works without any SSL complaints.

I double checked this with a brand new venv:

# go to project directory
$ pip install -e .
Obtaining file:///Users/jdandrea/projects/myproject
    Complete output from command python setup.py egg_info:
    Download error on https://pypi.python.org/simple/pbr/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
    Couldn't find index page for 'pbr' (maybe misspelled?)
    Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
    No local packages or working download links found for pbr>=1.8
    Traceback (most recent call last):
    ......
$ pip install pbr>=1.8
$ pip list | grep pbr
pbr (1.10.0)
$ pip install -e
# everything installs, zero errors

I noticed everything was coming from cache though, so I recreated the venv and tried once more, this time using --no-cache-dir.

The install still failed unless I installed pbr @manually as a first step:

$ pip install --no-cache-dir 'pbr>=1.8'
Collecting pbr>=1.8
  Downloading pbr-1.10.0-py2.py3-none-any.whl (96kB)
  ......
Installing collected packages: pbr
Successfully installed pbr-1.10.0
$ pip install --no-cache-dir -e .
# everything installs, zero errors

Problem solved! Not a virtualenv issue.

As I'm also using MacPorts, sudo port install curl-ca-bundle (see this post) solved it straight away.

So you just had to install an actual ca-bundle into Python, or tell your OS to use a newer one?

Was this page helpful?
0 / 5 - 0 ratings