question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SSL: CERTIFICATE_VERIFY_FAILED with Python 3.6.0

See original GitHub issue
  • Pip version: 9.0.1
  • Python version: 3.6.0
  • Operating System: macOS Sierra

Description:

I am getting a certificate error for pypi.python.org when I run pip install -U channels. I don’t know if issue is related to pip or Python 3.6.0 or something else. I have tried the following suggestions but none of them worked.

pip --trusted-host pypi.python.org install -U channels

export PIP_CERT=/Users/user/Desktop/certificate_which_i_obtained_from_pypi_dot_python_dot_org.crt
pip install -U channels

The following cacert.pem is curl’s certificate. pip --cert /Users/user/cacert.pem install -U channels

I also suspect that the issue might have something to do with Python 3.6.0. Because consider the following output:

user@host:~$ python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> context = ssl.create_default_context()
>>> context.cert_store_stats()
{'x509': 0, 'crl': 0, 'x509_ca': 0}
>>> context.get_ca_certs()
[]
>>> 

What I’ve run:

(virtualenv) user@host:~/Documents/virtualenv$ pip install -U channels
Collecting channels
  Using cached channels-0.17.3-py2.py3-none-any.whl
Collecting asgiref>=0.13 (from channels)
  Using cached asgiref-1.0.0-py2.py3-none-any.whl
Collecting daphne>=0.14.1 (from channels)
  Using cached daphne-0.15.0-py2.py3-none-any.whl
Requirement already up-to-date: Django>=1.8 in ./lib/python3.6/site-packages (from channels)
Collecting six (from asgiref>=0.13->channels)
  Using cached six-1.10.0-py2.py3-none-any.whl
Collecting twisted>=16.0 (from daphne>=0.14.1->channels)
  Using cached Twisted-16.6.0.tar.bz2
    Complete output from command python setup.py egg_info:
    Download error on https://pypi.python.org/simple/incremental/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) -- Some packages may not be found!
    Couldn't find index page for 'incremental' (maybe misspelled?)
    Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) -- Some packages may not be found!
    No local packages or working download links found for incremental>=16.10.1
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/45/r4yr9bbj29dfbtxqv75_785m0000gn/T/pip-build-02d49zb3/twisted/setup.py", line 21, in <module>
        setuptools.setup(**_setup["getSetupArgs"]())
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/setuptools/dist.py", line 316, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/setuptools/dist.py", line 371, in fetch_build_eggs
        replace_conflicting=True,
      File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 846, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1118, in best_match
        return self.obtain(req, installer)
      File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1130, in obtain
        return installer(requirement)
      File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/setuptools/dist.py", line 439, in fetch_build_egg
        return cmd.easy_install(req)
      File "/Users/user/Documents/virtualenv/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 668, in easy_install
        raise DistutilsError(msg)
    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('incremental>=16.10.1')
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/45/r4yr9bbj29dfbtxqv75_785m0000gn/T/pip-build-02d49zb3/twisted/
(virtualenv) user@host:~/Documents/virtualenv$ 

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:23 (2 by maintainers)

github_iconTop GitHub Comments

69reactions
sdk21commented, May 6, 2018

Try installing new version of pip directly using get-pip.py (see https://pip.pypa.io/en/stable/installing/)

$ curl 'https://bootstrap.pypa.io/get-pip.py' > get-pip.py
$ sudo python get-pip.py

(formatted by @pradyunsg)

28reactions
CallenChencommented, Apr 5, 2017

pip install incremental

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - SSL: CERTIFICATE_VERIFY_FAILED with Python3
In my case, I used the ssl module to "workaround" the certification like so: import ssl ssl._create_default_https_context = ssl.
Read more >
How to fix Python SSL CERTIFICATE_VERIFY_FAILED
The reason behind this is Python 3.6 on macOS uses an embedded version of OpenSSL, which does not use the system certificate store....
Read more >
urllib and “SSL: CERTIFICATE_VERIFY_FAILED” Error - ...
If you have installed Python 3.6 on OSX and are getting the "SSL: CERTIFICATE_VERIFY_FAILED" error when trying to connect to an https:// site,...
Read more >
SSL: CERTIFICATE_VERIFY_FAILED Error in Python (2022)
In this video I will be showing you how you can solve the SSL : CERTIFICATE_VERIFY_FAILED Error in any Python version.
Read more >
SSL module problem on Python 3.6.0 and macOS Sierra
msg283976 ‑ (view) Author: Utku Gultopu (ugultopu) Date: 2016‑12‑24 22:28 msg283984 ‑ (view) Author: Ned Deily (ned.deily) * Date: 2016‑12‑25 03:11 msg283985 ‑ (view) Author:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found