✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

SSL Certificate Issue in Dash Tutorial

Currently working through the Dash tutorials as new to both python and Plotly Dash.

After completing two other Dash tutorials successful, I have run into a SSL issue after having produced an exact copy of the tutorial text. The url referenced in the tutorial with the data exists, as I have checked.

The tutorial is “Part 2 Dash Layout - Reusable Components - generates a Table from a Pandas dataframe”. https://dash.plotly.com/layout

My tutorial attempt produced a long error message terminating with:
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)>

Consulted the Plotly Community Forum for previous SSL issues. The two proposed solutions were offered in a post, but can’t get either to work (one of these is proposed below).

import os
os.environ[‘REQUESTS_CA_BUNDLE’] = ‘path to cer’

Any other ideas? (Using Pycharm).

Without knowing the exact line / command that causes you the error, or the full traceback, it is difficult to debug.

Stackoverflow has this: urllib and “SSL: CERTIFICATE_VERIFY_FAILED” Error question which looks related and has a few answers, and so does this SSL: CERTIFICATE_VERIFY_FAILED with Python3.

One thing that you could try to do is to update your certifi package using pip.

Hi @Korach,

  1. I checked the tracebacks you gave. As I assumed, there is no dash involved in the exception chain which means it is not related to dash itself, but your python code (or configuration) in general. I assume you’ll get similar error messages with just running the snippet below, or, in fact, when trying to connect to any https:// address using python. This would mean that the SSL configuration of your python installation is somehow incomplete or erroneous. Your code might actually run just fine if you replace https:// with http:// (if the script does not ty to connect any other https:// addresses.
import pandas as pd
df = pd.read_csv('https://gist.githubusercontent.com/chriddyp/c78bf172206ce24f77d6363a2d754b59/raw/c353e8ef842413cae56ae3920b8fd78468aa4cb2/usa-agricultural-exports-2011.csv')
  1. Maybe someone else could comment this but in my opinion this is in-topic since you are experiencing issues while following a Dash tutorial. Someone else with the same problem might find this helpful. If you think it is helpful, you can also post a SO question.
  2. It is nice to hear you are learning both python and dash, and good that you have found a tutorial to follow. I think it is good if you post here / and or StackOverflow a question about any problems you are facing, since those might help others. I personally don’t wish emails for support requests, since I am not working for Dash/plotly/python, but am just a ordinary person like you, trying to learn about python amongst other things, although I like to help whenever I have some spare time :slight_smile:

Regarding to your SSL problem, did you find anything new? I see you have probably a Mac (I have Windows) machine, and some version of Python 3.8. If you still have the problem I found two possible solutions: this and this. Perhaps one of them helps you to find a way to solve the issue?