Module Not found - Plotly - python

When I run the following code in jupyter I am thrown a module note found error. but when i run the import function in python it works without any errors. The jupyter version i have is 4.4.0 but in anaconda navigator it shows 5.3.0.
import plotly
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-6361d2547ebc> in <module>
----> 1 import plotly
ModuleNotFoundError: No module named 'plotly'

I installed plotly using pip install plotly but it required restarting as anaconda failed to recognize the installation

Can you try the following command in anaconda prompt?
conda install -c plotly plotly
then import again, hope this can help you

Related

Python 3.9 module not found after installing with pip

I have tried the following install commands -
python3.9 -m pip install plotly
pip3 install plotly
But jupyter notebook in vs code gives the following error
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-7-f6b2d252d652> in <module>
1 import pandas as pd
2 import numpy as np
----> 3 import plotly
ModuleNotFoundError: No module named 'plotly'
However, when I do the same code in a jupyter notebook through anaconda, it works. I would like to be able to use pip modules in vs code too as it is my favourite editor. I have tried changing the python version used in the jupyter notebook but it did not work.
Ps. I am using a mac
It's probably because VSCode is using the wrong version of Python.
Take a look at the bottom right corner. While I have Python 3.8 and 3.9 installed, VSC is using 3.7.6 version. You have to click there and select the correct version.

How to install packages in Anaconda environment in VScode?

I am running my code in VScode, my python interpreter being Anconda3\python.exe . When running the following code : -
from Ipython import display
I encounter the following error in the python terminal :
PS C:\Users\Clover\Desktop\Speech Recognition> C:/ProgramData/Anaconda3/python.exe "c:/Users/Clover/Desktop/Speech Recognition/ml_code_first.py"
Traceback (most recent call last):
File "c:/Users/Clover/Desktop/Speech Recognition/ml_code_first.py", line 11, in <module>
from Ipython import display
ModuleNotFoundError: No module named 'Ipython'
I've tried to install it on the conda terminal using :
pip install ipython
and it shows that requirement already satisfied which means the package is installed but why is this package not detected in VScode?
At least there is the warning from the conda developers: Never mix conda-forge installs and pip installs. This might help.

how to get ggplot in ipython

I have a similar problem as this post, however this fix didn't work for me. I am working in Spyder, Python 3.6 and want to run ggplot. After installing ggplot with pip, I am still unable to locate the module
import ggplot
Traceback (most recent call last):
File "<ipython-input-5-1140326dc452>", line 1, in <module>
import ggplot
ModuleNotFoundError: No module named 'ggplot'
EDIT:
I have also installed it in Anaconda Prompt with
pip install ggplot
and followed with
conda install ggplot
but have this error message
PackageNotFoundError: Packages missing in current channels:
- ggplot
Because you are using the Spyder environment, you need to install ggplot in a different manner, as described in this post:
conda install ggplot

After making the notebook importable it still gives import error

I followed this link to make my notebook importable but when I try to import the notebook, it gives me Import Error. This is the actual error that I get:
ImportError Traceback (most recent call last)
<ipython-input-23-4e9cc2ac3053> in <module>()
----> 1 import Notebooks.iPyLoader
ImportError: No module named iPyLoader
Error Image
I am trying to import the module iPyLoader from the Notebooks directory. As you can see when I run ls command it shows that the module is indeed present. What am I doing wrong or what am I missing?
I installed Jupyter Notebook using Anaconda.
Python 2.7 on Ubuntu 16.04 LTS
ipython --version
5.3.0
jupyter --version
4.3.0
jupyter notebook --version
5.0.0
Weird!
I tried to reproduce your issue, but without any success:
Could you please provide more information about your environment:
$ ipython --version
$ jupyter --version
$ jupyter notebook version
Anyway, pay attention that I have slightly different import error message. Not No module named iPyLoader, but No module name Notebooks.NotExits -- i.e with a full path. Maybe it will give you a clue.

Python - Can't import Seaborn

I'm running iPhyton Notebooks and I'm trying to import the Seaborn package. When I try to import it from the Terminal, it loads up fine, but when I import it through iPython Notebooks, it give me the following error.
I have even tried to re-install Seaborn using both Conda and Pip inside iPython notebooks and still it wont work.
Any idea why?
Thanks.
ImportError Traceback (most recent call last)
<ipython-input-1-417274a1ae6c> in <module>()
1 get_ipython().system(u'conda install seaborn')
2 get_ipython().system(u'pip install seaborn')
----> 3 import seaborn as sb
4
ImportError: No module named seaborn
Try this
import sys
print sys.path
sys.path.append('<path to package in your syste>')
import seaborn
In my Ubuntu 14.4LTS the packages get installed in the following folder
/usr/local/lib/python2.7/dist-packages
So I simply add the package path at run time
Donit install Ipython on all your system. Install it only in the environments you want it. Otherwise Ipython will look for modules in the default path instead of the environment's path.
This is probably where your ipython is looking:
/home/user/anaconda2/lib/python2.7/
It should be looking for modules here:
/home/user/anaconda2/envs/name-of-env/lib/python3.4/
To check the path you type:
import sys
sys.path
Try entering the following in your terminal:
conda install seaborn
It will install seaborn and make it available for you to import into your notebook
Open anaconda prompt and Type
pip install seaborn

Categories