Importerror: 'No Module Named Plotly. Plotly' in Linuxmint17.3
I Am New in Python. Whenever I Am Trying to Compile the Following Code to Get a Line Graph Shows Some Errors. but I Don't Know How to Fix It. Here Is My Code...
I am New in Python. Whenever I am trying to compile the following code to get a line graph shows some errors. But I don't know how to fix it. Here is my code :
import plotly.plotly as py
import plotly.graph_objs as go
# Create random data with numpy
import numpy as np
N = 500
random_x = np.linspace(0, 1, N)
random_y = np.random.randn(N)
# Create a trace
trace = go.Scatter(
x = random_x,
y = random_y
)
data = [trace]
py.iplot(data, filename='basic-line')
Shows the following error :
mks@mks-H81M-S /media/mks/KUTUBUDDIN1/test $ python datdaPlot.py
Traceback (most recent call last):
File "datdaPlot.py", line 1, in <module>
import plotly.plotly as py
ImportError: No module named plotly.plotly
mks@mks-H81M-S /media/mks/KUTUBUDDIN1/test $
Please help to fix this. Thanks in advance.
Added:
According to Spandan Brahmbhatt, I have installed pip by sudo pip install plotly. But still shows the following error:
17 Answers
You will need to install them first.
pip install plotly
pip install cufflinks
In my case I wanted to use in a Jupyter Notebook in Windows 10 but was getting the same error
ModuleNotFoundError Traceback (most recent call last) in ----> 1 import plotly.express as px
ModuleNotFoundError: No module named 'plotly'
Considering you can also install Anaconda in Linux Mint and these came with Anaconda (in my case), if you decide to go with Anaconda you'll have at least two options to install plotly
Anaconda Prompt
Anaconda Navigator
Once installed, you'll be able to use it without any problem
Must Read
1. Anaconda Prompt
Open Anaconda Prompt
Run the following command
conda install -c plotly plotly=4.8.1