How do I fix a deprecated module for plotly.plotly

Viewed 23447

I am just beginning my Python journey and trying to replicate code from: Using Python and Auto ARIMA to Forecast Seasonal Time Series

When I attempt to run the following:

import plotly.plotly as ply

I receive the following import error:

The plotly.plotly module is deprecated, please install the chart-studio package and use the chart_studio.plotly module instead.

I have tried uninstalling and then reinstalling plotly into my Anaconda instance, but to no avail.

6 Answers

The following steps serve the purpose:

  1. Installing chart-studio by running the following in Anaconda Prompt:
pip install chart-studio
  1. Importing plotly from chart-studio package by running:
from chart_studio import plotly

in place of from plotly import plotly.

One can learn more about chart-studio here.

As mentioned above, you can use plotly as follows:

from chart_studio import plotly

After that, you can use other associated libraries as usual:

import plotly.offline as pyoff
import plotly.graph_objs as go

I hope this was useful

Downgrading the version helps. Try this:

!pip install plotly==3.10.0
from chart_studio import plotly

This solved my error in google colab

Install chart-studio with pip install chart-studio at the command line/terminal.

First, install the chart-studio conda package.

conda install -c plotly chart-studio

Then use the following to import pyplot instead of "import plotly.plotly as ply"

from chart-studio import pyplot as ply

use this

import plotly.offline as pyoff
import plotly.graph_objs as go
fig=dict(data=go.Scatter(x=[1,2,3,4],y=[1,4,9,16],mode = "lines+markers"))
pyoff.iplot(fig)
Related