Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix a deprecated module for plotly.plotly

Tags:

python

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.

like image 244
Confucion Avatar asked May 29 '20 20:05

Confucion


People also ask

Is the Plotly module deprecated?

I think should provide a little more context and say something like: The plotly.plotly module is deprecated. To create figures using the Chart Studio service, please install the chart-studio package and use the chart_studio.plotly module instead.

How do I use Plotly in JupyterLab?

This is an example of a plotly graph correctly rendering inside dash: In order to use plotly in JupyterLab, you must have the jupyterlab-plotly extension installed as detailed in the Getting Started guide. When you install plotly, this extension is automatically made available to any JupyterLab 3.x installation in the same Python environment.

Why is Plotly not installed in Python?

This error occurs when Python does not detect the Plotly library in your current environment. This tutorial shares the exact steps you can use to troubleshoot this error. Since Plotly doesn’t come installed automatically with Python, you’ll need to install it yourself.

How do I know if Plotly has been installed?

The easiest way to do so is by using pip, which is a package manager for Python. You can then run the following code to see if Plotly was successfully installed:


3 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.

like image 184
Shayan Shafiq Avatar answered Oct 19 '22 09:10

Shayan Shafiq


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

like image 4
Taie Avatar answered Oct 19 '22 07:10

Taie


Downgrading the version helps. Try this:

!pip install plotly==3.10.0
from chart_studio import plotly

This solved my error in google colab

like image 2
Yashwanth Nandi Avatar answered Oct 19 '22 07:10

Yashwanth Nandi