Error running dash after upgrade of plotly

I had an issue when I tried to use tabs from DCC. I thought I might try and upgrade to see if I was behind in versions. now with all my dash applications after a

pip install plotly --upgrade

I get: app2.py is a simple example from your site.

File “app2.py”, line 3, in
import dash_html_components as html
File “/usr/local/lib/python3.7/site-packages/dash_html_components/init.py”, line 20, in
‘dash_html_components’
File “/usr/local/lib/python3.7/site-packages/dash/development/component_loader.py”, line 51, in load_components
namespace
File “/usr/local/lib/python3.7/site-packages/dash/development/base_component.py”, line 441, in generate_class
exec(string, scope)
File “”, line 44
def init(self, children=None, id=Component.UNDEFINED, n_clicks=Component.UNDEFINED, n_clicks_timestamp=Component.UNDEFINED, key=Component.UNDEFINED, role=Component.UNDEFINED, async=Component.UNDEFINED, charSet=Component.UNDEFINED, crossOrigin=Component.UNDEFINED, defer=Component.UNDEFINED, integrity=Component.UNDEFINED, src=Component.UNDEFINED, type=Component.UNDEFINED, accessKey=Component.UNDEFINED, className=Component.UNDEFINED, contentEditable=Component.UNDEFINED, contextMenu=Component.UNDEFINED, dir=Component.UNDEFINED, draggable=Component.UNDEFINED, hidden=Component.UNDEFINED, lang=Component.UNDEFINED, spellCheck=Component.UNDEFINED, style=Component.UNDEFINED, tabIndex=Component.UNDEFINED, title=Component.UNDEFINED, **kwargs):
^

Can you try with those versions ?

dash==0.23.1
dash-html-components==0.12.0-rc2
dash-core-components==0.27.0-rc2

Thanks for the suggestion. I have tried and no change. I also uninstalled and retried…

pip install dash==0.23.1
Collecting dash==0.23.1
Requirement already satisfied: dash-renderer in /usr/local/lib/python3.7/site-packages (from dash==0.23.1) (0.13.0)
Requirement already satisfied: plotly in /usr/local/lib/python3.7/site-packages (from dash==0.23.1) (1.13.0)
Requirement already satisfied: flask-compress in /usr/local/lib/python3.7/site-packages (from dash==0.23.1) (1.4.0)
Requirement already satisfied: Flask>=0.12 in /usr/local/lib/python3.7/site-packages (from dash==0.23.1) (1.0.2)
Requirement already satisfied: six in /usr/local/lib/python3.7/site-packages (from plotly->dash==0.23.1) (1.11.0)
Requirement already satisfied: pytz in /usr/local/lib/python3.7/site-packages (from plotly->dash==0.23.1) (2018.5)
Requirement already satisfied: requests in /usr/local/lib/python3.7/site-packages (from plotly->dash==0.23.1) (2.19.1)
Requirement already satisfied: Jinja2>=2.10 in /usr/local/lib/python3.7/site-packages (from Flask>=0.12->dash==0.23.1) (2.10)
Requirement already satisfied: Werkzeug>=0.14 in /usr/local/lib/python3.7/site-packages (from Flask>=0.12->dash==0.23.1) (0.14.1)
Requirement already satisfied: click>=5.1 in /usr/local/lib/python3.7/site-packages (from Flask>=0.12->dash==0.23.1) (6.7)
Requirement already satisfied: itsdangerous>=0.24 in /usr/local/lib/python3.7/site-packages (from Flask>=0.12->dash==0.23.1) (0.24)
Requirement already satisfied: idna<2.8,>=2.5 in /usr/local/lib/python3.7/site-packages (from requests->plotly->dash==0.23.1) (2.7)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.7/site-packages (from requests->plotly->dash==0.23.1) (3.0.4)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /usr/local/lib/python3.7/site-packages (from requests->plotly->dash==0.23.1) (1.23)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/site-packages (from requests->plotly->dash==0.23.1) (2018.4.16)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/site-packages (from Jinja2>=2.10->Flask>=0.12->dash==0.23.1) (1.0)
Installing collected packages: dash
Successfully installed dash-0.23.1
HLCNCBXXX112701:testproj ryanicky$ python3 app2.py
Traceback (most recent call last):
File “app2.py”, line 3, in
import dash_html_components as html
File “/usr/local/lib/python3.7/site-packages/dash_html_components/init.py”, line 27, in
from .imports import *
File “/usr/local/lib/python3.7/site-packages/dash_html_components/imports.py”, line 100, in
from .Script import Script
File “/usr/local/lib/python3.7/site-packages/dash_html_components/Script.py”, line 48
def init(self, children=None, id=Component.UNDEFINED, n_clicks=Component.UNDEFINED, n_clicks_timestamp=Component.UNDEFINED, key=Component.UNDEFINED, role=Component.UNDEFINED, async=Component.UNDEFINED, charSet=Component.UNDEFINED, crossOrigin=Component.UNDEFINED, defer=Component.UNDEFINED, integrity=Component.UNDEFINED, src=Component.UNDEFINED, type=Component.UNDEFINED, accessKey=Component.UNDEFINED, className=Component.UNDEFINED, contentEditable=Component.UNDEFINED, contextMenu=Component.UNDEFINED, dir=Component.UNDEFINED, draggable=Component.UNDEFINED, hidden=Component.UNDEFINED, lang=Component.UNDEFINED, spellCheck=Component.UNDEFINED, style=Component.UNDEFINED, tabIndex=Component.UNDEFINED, title=Component.UNDEFINED, **kwargs):
^
SyntaxError: invalid syntax

New user here trying to pick up Dash.
Tried following the “Getting Started” guide with a fresh install of both Plotly and Dash, and I’m getting the exact same syntax error as @ryanicky.

Here are the versions I’m running:
dash==0.23.1
dash-core-components==0.26.0
dash-html-components==0.11.0
dash-renderer==0.13.0
plotly==3.1.0

I tried with the suggested release candidates:
dash-core-components==0.27.0rc2
dash-html-components==0.12.0rc2

and the syntax error switched to be with File "/usr/local/lib/python3.7/site-packages/dash_html_components/Script.py", line 48just like in @ryanicky’s last post.

I did some digging and managed to get something running for now by modifying the problematic file.

Seems like python 3.7 doesn’t like having async as a function argument:
https://docs.python.org/3/whatsnew/3.7.html
“Backwards incompatible syntax changes:
async and await are now reserved keywords.”

Other libraries with the same issue:


Deleting that argument from the init signature in File "/usr/local/lib/python3.7/site-packages/dash_html_components/Script.py", line 48 fixes the issue for now.

Not sure what the effects are, but since I’m just following the tutorial should hopefully be ok for now until this is fixed upstream :slight_smile:

1 Like

Thanks for reporting @zoohair! Note that the rc stands for “release candidate” so we’ll be doing testing on this release. Our more stable releases will not have the rc suffix in them.

np @chriddyp

To be clear though, the error occurs even with the already released
dash-core-components==0.26.0
dash-html-components==0.11.0

File “/usr/local/lib/python3.7/site-packages/dash/development/base_component.py”, line 441 also used the reserved async keyword.

This is really more of an issue of Python3.7 (which both myself and @ryanicky are using) which broke backward compatibility by introducing a reserved keyword and was only released ~6 weeks ago (https://www.python.org/downloads/release/python-370/)

Cheers,

My error occurred prior to loading any rc release as well. The rc suggestion was a fix to the problem. I started to try and upgrade due to the fact the Tags label could not be found in the DASH library? My dash version on my Mac is non functional I will work to get it running again after seeing this.

Thanks for reporting! We’ve got some fixes up in https://github.com/plotly/dash/pull/325

1 Like

Thanks. I have tried a forced upgrade and still have the same issue. what is the best procedure to follow to make sure the install is correct?

Richard

import dash
print(dash.__version__)

Thanks.

I forced a reinstall with pip. I have this version.

Python 3.7.0 (default, Jun 29 2018, 20:13:13)

[Clang 9.1.0 (clang-902.0.39.2)] on darwin

Type “help”, “copyright”, “credits” or “license” for more information.

>>> import dash

>>> print(dash.version)

0.23.1

I still have the same issue with running dash…

Right, so that’s the latest version. https://github.com/plotly/dash/pull/325 has the fixes but it hasn’t been released yet.

Thanks. I saw in the github the changes where accepted so I wanted to give it a try…

BTW: I think dash is a great tool. I have used shiny for many years and RCloud/RCAP recently and appreciate what dash brings to python development.

Thank You.

1 Like

Fixed in dash==0.24.1

1 Like

Thanks. I have reinstalled dash and it is working.