Hi! I am new to Dash and just installed plotly 4.0.0, where plotly.express is integrated. But I have some problem importing it.
When trying to run the example code:
import plotly.express as px
print(px.data.iris.__doc__)
px.data.iris().head()
I got this error:
ImportError Traceback (most recent call last)
<ipython-input-5-1979e3394739> in <module>
----> 1 import plotly.express as px
2 print(px.data.iris.__doc__)
3 px.data.iris().head()
~/anaconda3/lib/python3.7/site-packages/plotly/express/__init__.py in <module>
6 __version__ = "0.3.0"
7
----> 8 from ._chart_types import ( # noqa: F401
9 scatter,
10 scatter_3d,
~/anaconda3/lib/python3.7/site-packages/plotly/express/_chart_types.py in <module>
----> 1 from ._core import make_figure
2 from ._doc import make_docstring
3 import plotly.graph_objs as go
4
5
~/anaconda3/lib/python3.7/site-packages/plotly/express/_core.py in <module>
4
5 from _plotly_utils.basevalidators import ColorscaleValidator
----> 6 from .colors import qualitative, sequential
7 import math
8 import pandas
ImportError: cannot import name 'qualitative' from 'plotly.express.colors'
Is there anything I can do to solve it?
Hi @AmazingSean, this error suggests that there may be something corrupt in the environment. This was also reported in https://github.com/plotly/plotly_express/issues/123 and the problem went away after restarting the system.
First, make sure that you don't have plotly installed with both pip and conda. Try uninstalling and reinstalling like this.
$ pip uninstall plotly
$ conda uninstall plotly
$ conda install -c plotly plotly
If that doesn't help, could you try installing plotly in a fresh conda environment?
$ conda create -n plotly_install -c plotly python=3.7 plotly=4.0
$ conda activate plotly_install
Hi @AmazingSean. I was having the same issues and reinstalling the plotly and plotly express solved the problem for me.
Its working fine with Plotly 4.0.0 and Plotly_express 0.4.0
@jonmmease @Guyingreysneaks Thank you, guys! The problem went away after reinstalling plotly.
I installed it through conda. To "fix" it:
```
conda activate base
conda active [what-ever-environment]
````
then restart the jupyter notebook
FIXED! You don't have to reboot the entire OS
Most helpful comment
Hi @AmazingSean, this error suggests that there may be something corrupt in the environment. This was also reported in https://github.com/plotly/plotly_express/issues/123 and the problem went away after restarting the system.
First, make sure that you don't have plotly installed with both
pipandconda. Try uninstalling and reinstalling like this.If that doesn't help, could you try installing plotly in a fresh conda environment?