`import plotly` fails with `KeyError: 'metaKeys'`
See original GitHub issueRight now, import plotly
fails.
In [1]: import plotly
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-1-c27a4132ad2e> in <module>()
----> 1 import plotly
/Users/chriddyp/Repos/venvpy27/lib/python2.7/site-packages/plotly/__init__.py in <module>()
29 from __future__ import absolute_import
30
---> 31 from plotly import (plotly, graph_objs, grid_objs, tools, utils, session,
32 offline)
33 from plotly.version import __version__
/Users/chriddyp/Repos/venvpy27/lib/python2.7/site-packages/plotly/plotly/__init__.py in <module>()
8
9 """
---> 10 from . plotly import (
11 sign_in,
12 update_plot_options,
/Users/chriddyp/Repos/venvpy27/lib/python2.7/site-packages/plotly/plotly/plotly.py in <module>()
29 from requests.auth import HTTPBasicAuth
30
---> 31 from plotly import exceptions, tools, utils, version, files
32 from plotly.plotly import chunked_requests
33 from plotly.session import (sign_in, update_session_plot_options,
/Users/chriddyp/Repos/venvpy27/lib/python2.7/site-packages/plotly/tools.py in <module>()
18 from plotly import utils
19 from plotly import exceptions
---> 20 from plotly import graph_reference
21 from plotly import session
22 from plotly.files import (CONFIG_FILE, CREDENTIALS_FILE, FILE_CONTENT,
/Users/chriddyp/Repos/venvpy27/lib/python2.7/site-packages/plotly/graph_reference.py in <module>()
521 TRACE_NAMES = list(GRAPH_REFERENCE['traces'].keys())
522
--> 523 OBJECTS = _get_objects()
524 _patch_objects()
525 ARRAYS = _get_arrays()
/Users/chriddyp/Repos/venvpy27/lib/python2.7/site-packages/plotly/graph_reference.py in _get_objects()
404 for node, path in utils.node_generator(GRAPH_REFERENCE):
405
--> 406 if any([key in path for key in GRAPH_REFERENCE['defs']['metaKeys']]):
407 continue # objects don't exist under nested meta keys
408 if node.get('role') != 'object':
KeyError: 'metaKeys'
Several pages on the API are failing intermittently right now with a 504 and so I suspect that this URL https://api.plot.ly/v2/plot-schema.json?sha1=%22%22
is failing with like a 504 behind the scenes too.
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
KeyError: 'plotly_domain' - python - Stack Overflow
Based on this answer, try using py.plot instead of py.iplot . KeyError: 'plotly_domain' when using plotly to do scatter plot in python.
Read more >[Solved] Import error when trying to test my component in ...
This KeyError: 'props' usually means that the metadata.json file isn't what dash expects it to be (dash could certainly fail more gracefully ...
Read more >Key Error while grouping in Data Frame through Dropdown Input
However, I am getting the the error: KeyError: u'brand'. Following is the code: import dash import dash_core_components as dcc
Read more >Help: Plotly graph Error 0 - Plotly Community Forum
I am trying to use Plotly to plot a scatter plot with linear ... I followed this guide: I ended up with the...
Read more >Error in App an Key Error - Fixed it! (white space after column ...
Hi, Having issues getting my dashboard with multiple inputs to work. It will output a graph with no data and give me two...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for reporting @fchevitarese! We are working on a fix right now
@jlmcgehee21 100% agreed. Here’s a recap of what happened here:
import plotly
downloads the latestplot-schema.json
. Theplot-schema.json
contains all of the information about the available keys and chart types inplotly.graph_objs
. This means that as new features are added toplotly.js
, the python library automatically gets those updates.plot-schmea.json
to be malformed. Note that the API call technically “worked” (a 200 was returned) but the format of theplot-schema.json
wasn’t right. Had the API call failed, the python library would have just used the cached version.plot-schema.json
caused a typo while creating thegraph_objs
. This causedimport plotly
to fail.This library has fail-safes around the actual API calls - There is a 5 second timeout and a cached version of the
plot-schema.json
that gets included in the library: https://github.com/plotly/plotly.py/blob/master/plotly/graph_reference.py#L91-L107but no fail safes around creating the
graph_objs
based off of that plot-schema: https://github.com/plotly/plotly.py/blob/master/plotly/graph_reference.py#L517-L532.To make sure that this never happens again, we should either:
try
/except
around the construction ofgraph_objs
off of the downloadedplot-schema.json
and use the cached version if possible.import
and perform more frequent (weekly) releases of the python library in sync with the plotly.js version updates.