plotly chart-studio
raw JSON → 1.1.0 verified Fri May 01 auth: no python deprecated
Utilities for interfacing with plotly's Chart Studio service. Deprecated alternative to the Plotly Express / plotly.graph_objects + plotly.io approach. Version 1.1.0 is the final release; package is in maintenance mode.
pip install chart-studio Common errors
error AttributeError: module 'plotly' has no attribute 'plotly' ↓
cause Migrating from old plotly (pre-v3) to newer versions: 'plotly.plotly' was removed. Use chart_studio.plotly for Chart Studio functionality.
fix
Replace
import plotly.plotly as py with from chart_studio import plotly as py. error ImportError: cannot import name 'plotly' from 'chart_studio' (unknown location) ↓
cause chart_studio package not installed or version mismatch.
fix
Run
pip install chart-studio to install the package. error HTTPError: 401 Client Error: Unauthorized for url: https://api.plot.ly/v2/... ↓
cause Credentials are missing, invalid, or expired.
fix
Set credentials:
chart_studio.tools.set_credentials_file(username='your_username', api_key='your_api_key'). Obtain API key from https://plotly.com/settings/api. Warnings
deprecated chart-studio is in maintenance mode. The primary plotly package now includes Chart Studio upload via plotly.io.write_html() or using Plotly Express with the `url` parameter. Avoid new projects depending on chart-studio. ↓
fix Use `pip install plotly` and `plotly.io.write_html()` or `plotly.io.to_html()` for offline usage. For Chart Studio uploads, consider the new Plotly Chart Studio API: https://plotly.com/python/chart-studio/
breaking chart_studio.plotly.sign_in() requires a valid Chart Studio account and API key. Using invalid credentials leads to HTTP 401 errors. ↓
fix Set valid credentials via chart_studio.tools.set_credentials_file() before calling any upload function.
gotcha Importing from chart_studio.plotly overrides the top-level plotly module's plot function. This can break code that expects the offline plotly.plot() behavior. ↓
fix Use explicit module references: `import chart_studio.plotly as py` and then `py.plot(fig)` vs `plotly.io.show(fig)`.
Imports
- plotly wrong
import chart_studio.plotly as pycorrectimport plotly - plotly_plotly wrong
import plotly.plotly as pycorrectfrom chart_studio import plotly as py - plotly_credentials wrong
plotly.tools.set_credentials_file()correctfrom chart_studio import plotly as py py.sign_in(username, api_key)
Quickstart
import chart_studio
import chart_studio.plotly as py
import plotly.graph_objects as go
chart_studio.tools.set_credentials_file(username='your_username', api_key='your_api_key')
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
py.plot(fig, filename='basic-bar', auto_open=True)