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.

SSLError CERTIFICATE_VERIFY_FAILED for sampledata.download

See original GitHub issue

I have bokeh 0.9.0 via Macports and wanted to download the sample data as described here: http://bokeh.pydata.org/en/latest/docs/quickstart.html#sample-data

But I’m getting this SSL CERTIFICATE_VERIFY_FAILED error on Python 2 and 3:

$ python -c "import bokeh.sampledata; bokeh.sampledata.download()"
Creating /Users/deil/.bokeh/data directory
Using data directory: /Users/deil/.bokeh/data
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 1182, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 1088, in request
    self._send_request(method, url, body, headers)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 1126, in _send_request
    self.endheaders(body)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 1084, in endheaders
    self._send_output(message_body)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 922, in _send_output
    self.send(msg)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 857, in send
    self.connect()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 1231, in connect
    server_hostname=server_hostname)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ssl.py", line 365, in wrap_socket
    _context=self)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ssl.py", line 583, in __init__
    self.do_handshake()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ssl.py", line 810, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/bokeh/sampledata/__init__.py", line 72, in download
    _getfile(base_url, file_name, data_dir, progress=progress)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/bokeh/sampledata/__init__.py", line 78, in _getfile
    url = urlopen(file_url)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 161, in urlopen
    return opener.open(url, data, timeout)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 463, in open
    response = self._open(req, data)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 481, in _open
    '_open', req)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 441, in _call_chain
    result = func(*args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 1225, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 1184, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)>
$ python2.7 -c "import bokeh.sampledata; bokeh.sampledata.download()"
Using data directory: /Users/deil/.bokeh/data
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/deil/Library/Python/2.7/lib/python/site-packages/bokeh/sampledata/__init__.py", line 71, in download
    _getfile(base_url, file_name, data_dir, progress=progress)
  File "/Users/deil/Library/Python/2.7/lib/python/site-packages/bokeh/sampledata/__init__.py", line 75, in _getfile
    u = urlopen(url)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open
    context=self._context)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

20reactions
Denisevi4commented, Dec 22, 2017

I was able to solve this by executing the following:

import ssl ssl._create_default_https_context = ssl._create_unverified_context

1reaction
bryevdvcommented, Sep 18, 2019

@guyts That error is coming from holoviews (or possibly anaconda’s openssl package), not from bokeh. We don’t have any control over those things. You should file an issue on their GitHub issue tracker.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SSL ERROR CERTIFICATE_VERIFY_FAILED when trying to ...
Hi all, I am trying to download the bokeh sample data from an alpine docker container and I am facing the following SSL...
Read more >
SSL error with the sample data module (Linux only) - Support
I am getting a SSL certificate error for the sample data with ... line 812, in download File urllib.request.urlretrieve(uri, filePath, self.
Read more >
pip install fails with "connection error: [SSL - Stack Overflow
--trusted-host used to resolve the "'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate ...
Read more >
[Solved - urllib and “SSL: CERTIFICATE_VERIFY_FAILED” Error
The solution to our problem: Download the domain validation certificate as *.crt or *pem file; Open the file in editor and copy it's...
Read more >
error: failed to download sample dataset - MNE Forum
But the downloading the sample dataset is failing with … ... '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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