Installed package works in VSC bu not in Jupyter Notebook

  importerror, jupyter-notebook, package, python

I installed plotly using the terminal in VSC with the ‘pip install plotly’ command. So I thought I would be able to import plotly in Jupyter Notebook but it gave me an error like the one below.

This is the code I ran

import plotly.express as px
import numpy as np
X=np.array([1,2,3,4,5])
Y=np.array([5,3,1,5,8])
fig=px.line(x=X,y=Y)
fig.update_layout(width=500,height=380)
fig.show()

and this is the error

ModuleNotFoundError                       Traceback (most recent call last)
~AppDataLocalTemp/ipykernel_18584/39758698.py in <module>
----> 1 import plotly.express as px
      2 import numpy as np
      3 X=np.array([1,2,3,4,5])
      4 Y=np.array([5,3,1,5,8])
      5 fig=px.line(x=X,y=Y)

ModuleNotFoundError: No module named 'plotly'

I have no idea why there’s a problem importing in Jupyter because it works fine in VSC. I would appreciate a little help. Thank you.

Source: Python Questions

LEAVE A COMMENT