Hi, I am trying to use plotly with Python.
I think I installed it correctly, I can see Plotly when I list installed modules.
However, I cannot run the sample code provided as a first test.
To be more precise, if I copy paste line by line in the python shell, it works fine, and my graph is created. But, if I create a new python script, with the very same code, saved on my machine, and try to run it, I can an error in the first line "import plotly.plotly", saying that there is no module named plotly.
I really don't understand what may happen. Any help would be very much appreciated.
@danio368 , can you paste the exact exception traceback you get when you run the stand-alone script?
Thanks for your answer. I figured it out. Was a stupid Python beginner mistake. I had saved my script with the name of the module ('plotly.py'), which is why Python could not find the module.
Sorry for bothering you
@danio368 thanks for reporting, a common mistake!
@danio368 thanks for posting! helped me out - there was a file in my directory called plotly.py that was overriding the global module import. once i deleted/renamed that file - it worked! good find!
I do have the same problem and it is not the file name.
Could you please give me a hand?
This is my exact console output:
python pp.py
Traceback (most recent call last):
File "pp.py", line 1, in <module>
from plotly import __version__
File "/home/vicco/Desktop/git/plotly/plotly.py", line 1, in <module>
ImportError: No module named plotly
@VictorCruzIsc is your app in a folder named plotly? try renaming the file and folder to something else (like /home/vicco/Desktop/git/plotly_app/plotly_stuff.py
Nice answer!! That confusing me all the morning!!!!
This is exactly what I have encountered, thank you very much.

I am still getting this error ...
I tried -
conda install plotly
conda install nb_conda
conda install -c https://conda.anaconda.org/plotly
conda install plotly cufflinks
pip install cufflinks plotly
Don't know what's the issue
me too i have the same problem:
ImportError:
The plotly.plotly module is deprecated,
please install the chart-studio package and use the
chart_studio.plotly module instead.
also
AttributeError: 'DataFrame' object has no attribute 'iplot'
could you help me i based my project on plotly
Starting with plotly version 4.0 you have to replace import plotly.plotly as py by
import chart_studio.plotly as py to send a figure to Plotly cloud.
Starting with plotly version 4.0 you have to replace
import plotly.plotly as pyby
import chart_studio.plotly as pyto send a figure to Plotly cloud.
what about the other commands like
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
cuz all of above commands results in same issue for me?
Thanks for your help in advance
Most helpful comment
Thanks for your answer. I figured it out. Was a stupid Python beginner mistake. I had saved my script with the name of the module ('plotly.py'), which is why Python could not find the module.
Sorry for bothering you