Issue with importing Seaborn - python-3.x

When I try to import seaborn the import give me the below error message:
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import seaborn
ModuleNotFoundError: No module named 'seaborn'
I have tried the below steps to install:
pip install seaborn
python -m pip install seaborn
!conda install seaborn
%%bash pip install seaborn
pip3 install seaborn
conda install seaborn
sudo pip install utils ...and then install seaborn again
pip uninstall scipy and then install scipy package again.
These are the solutions I found, I closed iTerm and started it again and none of these worked.

Make sure you have Python and pip installed on your computer. Reinstall it if you have it. Try pip install seaborn. Also, make sure you are installing it in the same directory as where you are working. If that issue still persists, there must be a problem with your shell or computer.
PS:
If you are using Juypter Notebook do in a cell:
import sys
!{sys.executable} -m pip install seaborn

Related

How to import in python 3?

I am self-learning Python and all the online courses use labs where all libraries are already imported. Whenever I try to import numpy or pandas or any other library I receive this message:
"Traceback (most recent call last):
File "<pyshell#6>", line 1, in
import numpy as np
ModuleNotFoundError: No module named 'numpy'"
What am I doing wrong?
import-error-no-module-named-numpy
ModuleNotFoundError is thrown when a module could not be found
Support for Python 3 was added in NumPy version 1.5.0
you do not install numpy Correctly
pip uninstall numpy
pip3 install numpy
I strongly recommend you use Virtualenv to install it numpy
pip install virtualenv
go to folder of your code use
virtualenv venv
//Windows
venv\Scripts\activate
//Linux
source venv/bin/activate
you can use conda to install numpy
download conda from here coda GUI installer
Best practice, use an environment rather than install in the base env
conda create -n my-env
conda activate my-env
If you want to install from conda-forge
conda config --env --add channels conda-forge
The actual install command
conda install numpy

How to fix errors importing modules on python3

I successfully import modules on python but I keep having the same output error ModuleNotFoundError: No module named '' error.
I installed matplotlib, eyeD3 and mutagen several times within the mac terminal:
#I used this code to install matplotlib on mac terminal
pip install --user matplotlib
#I used this code to install eyeD3 on mac terminal
pip install eyeD3
As I try to import matplotlib like the code below (or eyeD3) I get that Traceback error.
#to import matplotlib for example
import matplotlib.pyplot as plt
x = [1,2,3]
y = [2,4,1]
plt.plot(x, y)
plt.xlabel('x - axis')
plt.ylabel('y - axis')
plt.title('My first graph!')
plt.show()
All of the modules listed above installed correctly, but when I import one of the modules I get the same common error ModuleNotFoundError: No module named ''
I think you have at least 2 version of python on your computer.
When you write pip install matplotlib, it install matplotlib on python.
But when you start the programm, an other version of python is launch.
To fix it :
The command python -m pip install matplotlib will install matplotlib on the version that you want.
If you want to use python 3.X, just write python3 -m pip install matplotlib
If you want to use the last version that is install on your computer, write py -m pip install matplotlib.
You can do that for every module that you have to install.
I hope it will help you.

Mac OS X: "ModuleNotFoundError: No module named 'numpy'"

After I have reinstalled Anaconda, I can not import NumPy any more on Python 3:
import numpy as np
Output:
ModuleNotFoundError: No module named 'numpy'
I have tried
pip install numpy
I try to install it again, but I get:
pip install numpy
Output:
Requirement already satisfied: numpy in /anaconda3/lib/python3.7/site-packages (1.16.3)
Screenshot of some of the above
This command worked for me
python3 -m pip install numpy
You probably have multiple NumPy versions installed on your system and need to manually delete the old one.
Open Terminal and run:
pip list
Remember or notate the NumPy version from the list
Then run Python in Terminal or write and execute this code in your IDE:
import numpy
print(numpy)
print(numpy.version)
This should print two lines: numpy package location + numpy version like this:
<module 'numpy' from '/usr/local/lib/python2.7/site-packages/numpy/init.pyc'>
1.16.1
If the NumPy version reported here is different than the one reported by pip list, then go to the NumPy package location printed above and delete that package folder
Try importing NumPy now. If you previously installed it, it should work. If you didn't install it then go and install it now. After installation all should work fine.
You are using a Conda environment to run your program. So you should run:
conda install numpy
If you use IDE like PyCharm, it will be easy to install packages by a mouse click (Install packages).

No module named 'pandas_datareader' in Jupyter (Anaconda) after I run pip3 install pandas_datareader

I am trying to learn pandas and want to load some stocks data. I was following a course which advised me to load pandas.io.data, but this did not work as io.data was depreciated. So I decided to use pandas-datareader instead. But I am struggling to instal it on mac in Anaconda (Jupiter notebook).
First time I run import pandas_datareader as pdweb I got ModuleNotFoundError: No module named 'pandas_datareader'. Not surprising as I never used this before so I run pip3 install pandas_datareader in Terminal which successfully installed itself. However, Jupiter notebook is still giving me the same error. At this point, I tried running in Terminal conda install -c https://conda.anaconda.org/anaconda pandas-datareader but it did not work as -bash: conda: command not found.
Please help. I am looking for a detailed explanation as I am not too techie.
What I run in Jupiter
import numpy as np
from pandas import Series, DataFrame
import pandas as pd
import pandas_datareader as pdweb
import datetime
Result
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-da568f513c93> in <module>
2 from pandas import Series, DataFrame
3 import pandas as pd
----> 4 import pandas_datareader as pdweb
5 import datetime
ModuleNotFoundError: No module named 'pandas_datareader'
Just run
conda install -c anaconda pandas-datareader
as per instructions here.
In my experience, if you're using conda, you should never install with pip unless you're sure conda doesn't have it. Try searching anaconda.org to see which -c source to use.
The problem was with conda command not being set up during the installation of Anaconda. I solved this by removing Anaconda with App Cleaner & Uninstaller Pro (free soft) and reinstalling later version.
After reinstallation of Anaconda command below worked like a charm.
conda install -c anaconda pandas-datareader
If you using Anaconda and still have issues installing panads-datareader using the conda command 'conda install -c anaconda pandas-datareader'. or the installation is successful but the import pandas_datareader.data as web still gives an error.
Locate where your 'site-packages % ' directory and cd to the site-packages % dir and then run the installation command 'conda install -c anaconda pandas-datareader '. It will work.
For the install, try using
pip
instead of
pip3

ModuleNotFoundError: No module named 'orangecontrib'

I am trying to install Orange package
I went to their website and follow exactly what has been said following this link
https://orange.biolab.si/download/
I have anaconda and install it through command prompt Windows 10 pc
conda config --add channels conda-forge
and approved installing all additional packages
I opened my jupyter notebook and pip installed
!pip install orange3
nothing went up
import csv
import pandas as pd
import matplotlib.pyplot as plt
import Orange
from Orange.data import Domain, DiscreteVariable, ContinuousVariable
This turns out to be okay but when I do
from orangecontrib.associate.fpgrowth import *
Things do not work up as expected with the following error message
ModuleNotFoundError: No module named 'orangecontrib'
I am working as the following link
I've also faced that problem. You'll have to install the associated Orange libraries:
pip3 install Orange3-Associate

Resources