Confucion
Confucion

Reputation: 101

How do I fix a deprecated module for plotly.plotly

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.

Upvotes: 10

Views: 42440

Answers (6)

behnam4444
behnam4444

Reputation: 21

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)

Upvotes: 1

Marnim Galib
Marnim Galib

Reputation: 11

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

Upvotes: 1

Yashwanth Nandi
Yashwanth Nandi

Reputation: 41

Downgrading the version helps. Try this:

!pip install plotly==3.10.0
from chart_studio import plotly

This solved my error in google colab

Upvotes: 4

Taie
Taie

Reputation: 1179

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

Upvotes: 5

RedKnite
RedKnite

Reputation: 1545

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

Upvotes: 1

Shayan Shafiq
Shayan Shafiq

Reputation: 1469

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.

Upvotes: 17

Related Questions