'ModuleNotFoundError: No module named 'plotly'

After reading all the existing post related to this issue, i still did not manage to fix it.

ModuleNotFoundError: No module named 'plotly'

I have tried all the following:

pip3 install plotly
pip3 install plotly --upgrade

as well as uninstalling plotly with:

pip3 uninstall plotly 

And reinstalling it again, i get the following on terminal:

Requirement already satisfied, skipping upgrade: six in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly) (1.11.0)
Requirement already satisfied, skipping upgrade: nbformat>=4.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly) (4.4.0)
Requirement already satisfied, skipping upgrade: retrying>=1.3.3 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly) (1.3.3)
Requirement already satisfied, skipping upgrade: urllib3<1.25,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests->plotly) (1.24.1)
Requirement already satisfied, skipping upgrade: idna<2.8,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests->plotly) (2.7)
Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests->plotly) (3.0.4)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests->plotly) (2018.10.15)
Requirement already satisfied, skipping upgrade: jsonschema!=2.5.0,>=2.4 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nbformat>=4.2->plotly) (2.6.0)
Requirement already satisfied, skipping upgrade: jupyter-core in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nbformat>=4.2->plotly) (4.4.0)
Requirement already satisfied, skipping upgrade: traitlets>=4.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nbformat>=4.2->plotly) (4.3.2)
Requirement already satisfied, skipping upgrade: ipython-genutils in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nbformat>=4.2->plotly) (0.2.0)

import plotly
import plotly.plotly as py

yield:

ModuleNotFoundError: No module named 'plotly'

my version of pip(3) as well as python(3) seem to be both fine May somebody please help?

Using Python3 on Atom 1.32.2 x64



Solution 1:[1]

Just run this to uninstall plotly and then build it from source. That should fix the import

pip uninstall plotly && python -m pip install plotly

Solution 2:[2]

That sounds like a classic dependency issue.

  • Check that your pip version is using the same python version (3.6) as what you launch your script with (IE: Use python3(.6) to launch your script, not just python)

  • Your logs aren't showing plotly already installed. In fact, you probably forgot a line when pasting but installing with pip3.6 install -U plotly should install the package if not already installed.

Solution 3:[3]

I did pip install plotly. It did not work.

Then, I just closed my jupyter-notebook from terminal and opened it again. It worked. Strangely restarting the kernel did not work!

Solution 4:[4]

If you are using Jupyter notebook, try below:

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

Solution 5:[5]

I could with:

conda install -c https://conda.anaconda.org/plotly plotly

Solution 6:[6]

  • First of all, Make sure your Python file is NOT called plotly.py but something else.
  • 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.
  • Or just type pip install plotly it will install the package and just restart the kernel hopefully you would be good to go

Solution 7:[7]

best way is to

1-run anaconda navigator 2-go to environment 3- select all 4-and search plotly 5- if not their install it.

enter image description here got my issue fixed

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Amit Acharya
Solution 2 WayToDoor
Solution 3 harsh
Solution 4 blackbrandt
Solution 5 blackbrandt
Solution 6 samir azazy
Solution 7 mohd Bilal