[solved] Update to plotly-4.0.0 broke application

So after restarting my laptop today my whole application won’t start anymore, because of error:

Traceback (most recent call last):
  File "launch_graph_app.py", line 21, in <module>
    import plotly.plotly as py
  File "/Users/max/anaconda3/lib/python3.7/site-packages/plotly/plotly/__init__.py", line 4, in <module>
    _chart_studio_error("plotly")
  File "/Users/max/anaconda3/lib/python3.7/site-packages/_plotly_future_/__init__.py", line 49, in _chart_studio_error
    submodule=submodule
ImportError: 
The plotly.plotly module is deprecated,
please install the chart-studio package and use the
chart_studio.plotly module instead. 

Which I do not really understand, since the line 21 of my application is simply empty.
The imports are the following:

import base64
import datetime
import io
import time
import numpy as np
from PIL import Image


import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
#from flask_caching import Cache

import pandas as pd
import sys
import os
import re


sys.path.append(os.path.realpath(__file__))
import graph_definitions as GD
import menu_definitions as MD
import algorythm_definitions as AD

I could imagine that the graph_definitions file causes that problem, where the imports are:

import plotly.graph_objects as go
from plotly import tools
from plotly.subplots import make_subplots
import os
import sys
import math
import numpy as np
sys.path.append(os.path.realpath(__file__))
import algorythm_definitions as AD

Well, I tried to import plotly.chart_studio there, and the error didnt change, and I did not find any help how to migrate to chart studio anywhere I tried to revert back to the previous version by
pip install plotly==3.10.0.

After undoing all changes that I have done to try the migration, I however now get a different error, namely:

  File "launch_graph_app.py", line 25, in <module>
    import graph_definitions as GD
  File "/Users/max/Desktop/Office/Phd/pythoncode/graph_app/graph_definitions.py", line 13, in <module>
    import plotly.graph_objects as go
ModuleNotFoundError: No module named 'plotly.graph_objects'

How do I fix this?

Okay, I eventually found this guide:


(don’t know what took me so long)
And the key part which did break my application is that I needed to use

conda install -c plotly chart-studio

instead of pip install.
Then a simple

import chart_studio.plotly

in my graph_definitions file was enough to make my application work on plotly 4.0.
Although the import remains unused it seems to be necessary…