Plotly.py: ModuleNotFoundError: No module named 'plotly'

Created on 7 Jan 2020  路  23Comments  路  Source: plotly/plotly.py

I am a beginner here , as part of my learning module which requires Plotly , i followed the standard method of using pip install plotly and pip install cufflinks - after successful installation when i call them on my jupyter note book , i am getting this error .

ModuleNotFoundError Traceback (most recent call last)
in ()
1 import pandas as pd
2 import numpy as np
----> 3 from plotly import __version__
4 print(__verison__)

ModuleNotFoundError: No module named 'plotly'

Tried few of the options mentioned like downgrading Plotly etc etc but of no use , request your support . sorry if the question is lame.

Most helpful comment

just type " pip install plotly " it will install the package and just restart the kernel hopefully you would be good to go

All 23 comments

Hi @karthikGandiban are you using a virtual environment when installing plotly? One common issue is when the jupyter notebook is not launched in the same environment as the one where plotly is installed.
Could you please paste here the output of

pip list | grep plotly

if you're working on Mac or linux, or just

pip list

if you're on Windows.

C:\Users\gak2ban>pip list
Package Version


attrs 19.3.0
backcall 0.1.0
beautifulsoup4 4.8.1
bleach 3.1.0
certifi 2019.11.28
chardet 3.0.4
chart-studio 1.0.0
colorama 0.4.3
colorlover 0.3.0
cufflinks 0.17.0
cycler 0.10.0
decorator 4.4.1
defusedxml 0.6.0
entrypoints 0.3
html5lib 1.0.1
idna 2.8
importlib-metadata 1.3.0
ipykernel 5.1.3
ipython 7.11.1
ipython-genutils 0.2.0
ipywidgets 7.5.1
jedi 0.15.2
Jinja2 2.10.3
json5 0.8.5
jsonschema 3.2.0
jupyter-client 5.3.4
jupyter-core 4.6.1
jupyterlab 1.2.0
jupyterlab-server 1.0.6
kiwisolver 1.1.0
lxml 4.4.2
MarkupSafe 1.1.1
matplotlib 3.1.2
mistune 0.8.4
more-itertools 8.0.2
nbconvert 5.6.1
nbformat 4.4.0
notebook 6.0.2
numpy 1.17.4
pandas 0.25.3
pandocfilters 1.4.2
parso 0.5.2
pickleshare 0.7.5
pip 19.3.1
plotly 4.4.1
prometheus-client 0.7.1
prompt-toolkit 3.0.2
Pygments 2.5.2
pyparsing 2.4.5
pyrsistent 0.15.6
python-dateutil 2.8.1
pytz 2019.3
pywin32 227
pywinpty 0.5.7
pyzmq 18.1.1
requests 2.22.0
retrying 1.3.3
scipy 1.4.1
seaborn 0.9.0
Send2Trash 1.5.0
setuptools 40.8.0
six 1.13.0
soupsieve 1.9.5
SQLAlchemy 1.3.12
terminado 0.8.3
testpath 0.4.4
tornado 6.0.3
traitlets 4.3.3
urllib3 1.25.7
wcwidth 0.1.8
webencodings 0.5.1
widgetsnbextension 3.5.1
xlrd 1.2.0
zipp 0.6.0

I have the same problem. Also, I failed to install Cufflinks in Windows 10. Could anyone please give a hand?

Have the same issue.

image

image

same issue using jupyter in IBM's Skills Network Lab

import plotly as px

ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import plotly as px

ModuleNotFoundError: No module named 'plotly'

import plotly.express as px

ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import plotly.express as px

ModuleNotFoundError: No module named 'plotly'

@harshitcodes I encountered this problem while implementing from your post "Building COVID-19 interactive dashboard from Jupyter Notebooks"

just type " pip install plotly " it will install the package and just restart the kernel hopefully you would be good to go

same issue.Please help @emmanuelle

@harshitcodes did the issue get resolved. if so please help

@Vegeta1313 , @ashraf-ul @likesh11235 : i resolved this issue by creating a new environment ( i am using Anaconda Navigator to launch Python) and installed the libraries in the new environment and now everything is back to normal.

import plotly.express as px
ModuleNotFoundError: No module named 'plotly.express'; 'plotly' is not a package.

I'm getting this despite having installed it using pip. I'm using a virtualenv and if I try importing the same inside python shell, it works. but not via the program I'm running.

If you are using Anaconda, open Anaconda Navigator and launch cmd prompt (cmd.exe) from there. Then run pip install plotly or conda install -c plotly from that terminal window. I had the same issue and this is what resolved it for me, despite having plotly already installed on the machine.

I have the same issue. When I open Anaconda - Terminal on Windows and type pip list, I can see it is in the list.
Also in the Anaconda, under installed packages I can see that plotly is there.
I even checked manually in - C:\Users\User\Anaconda3\pkgs and there is a folder called plotly in there.

But when I try to go on jupyter notebook and type import plotly, it gives me the error No module named plotly. Can someone help please?

I have the same issue. When I open Anaconda - Terminal on Windows and type pip list, I can see it is in the list.
Also in the Anaconda, under installed packages I can see that plotly is there.
I even checked manually in - C:\Users\User\Anaconda3\pkgs and there is a folder called plotly in there.

But when I try to go on jupyter notebook and type import plotly, it gives me the error No module named plotly. Can someone help please?

Update:

I followed this from stackoverflow and it works.

import sys
!conda install --yes --prefix {sys.prefix} plotly

Source: https://stackoverflow.com/questions/36959782/plotly-in-jupyter-issue

Have the same issue.

image

image

Same issued on me (Use PyCharm) TnT

If you are using Anaconda, open Anaconda Navigator and launch cmd prompt (cmd.exe) from there. Then run pip install plotly or conda install -c plotly from that terminal window. I had the same issue and this is what resolved it for me, despite having plotly already installed on the machine.

Worked for me as well when installed from Anaconda cmd prompt

Have the same issue.
image
image

Same issued on me (Use PyCharm) TnT

I have faced similar issue with Plotly. Than I found out this is due to pandas library was not installed.

Can you install pandas library and check if you still getting error.

conda

Launch CMD.exe from Anaconda navigator and type "pip install plotly".

@Vegeta1313 , @ashraf-ul @likesh11235 : i resolved this issue by creating a new environment ( i am using Anaconda Navigator to launch Python) and installed the libraries in the new environment and now everything is back to normal.

Yes ... i tried it in another environment and it worked for me ... Thanks.

For those of you in a virtual environment, did you add the kernel to Jupyter? After install plotly and cufflinks (with conda) into that environment, I was having the same problem and fixed it with:

conda activate myenv     
ipython kernel install --name myenv --user    
jupyter notebook

After jupyter launched, I loaded my notebook and then changed from Python3 to myenv in the navigation bar under:

Kernel > Change kernel > myenv

And then plotly would import!

use command: python3 -m pip install plotly

I am having the same issue. I am trying to plot the model object using 3D graph.
It's throwing's me the following error-
No module named 'plotly.validators.layout'

I have tried some of the options from above, such as uninstalling or updating the plotly but nothing is working out for me. I am trying to run the code from Anaconda Prompt - Jupyter Notebook. Any help is highly appreciated.

Thanks in advance.

@pratikghatake
so if you are using Anaconda prompt, then instead of running pip install plotly command in cmd/terminal, try running the same command in Anaconda prompt, your issue will be instantly solved

If you are using Anaconda Navigator and already checked(using pip list) that you have installed plotly, this will solve your problem:
Go to Environments tab in your Navigator, click on the sideway triangle next to Anaconda environment below base(root) environment, and then click "open with Jupyter Notebook". Then, your Jupyter will recognize plotly in your notebook.

image

Was this page helpful?
0 / 5 - 0 ratings