I'm using Python 3.7.5 and Windows 10. I installed matplotlib via pip but now if I run:
import matplotlib.pyplot as plt
The output is:
Traceback (most recent call last):
File "C:\Users\Pol\Documents\Python\hallo.py", line 1, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
How can I overcome this?
Related
I downloaded spyder and practicing I have tried to use commands that generate an error.
The command is as follows:
import numpy as np
from sklearn import dataset, linear_model
import matplotlib.pyplot as plt
boston = datasets, load_boston()
print(boston)
print()
and spyder says:
runcell(0, 'C:/Users/HP/.spyder-py3/temp.py')
Traceback (most recent call last):
File "C:\Users\HP\.spyder-py3\temp.py", line 9, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
runcell(0, 'C:/Users/HP/.spyder-py3/temp.py')
Traceback (most recent call last):
File "C:\Users\HP\.spyder-py3\temp.py", line 9, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
You should install matplotlib into spyder via the pip.exe from the spyder package.
C:\Users\Ann>cd C:\ProgramData\Anaconda3\pkgs\pip-19.2.3-py37_0\Scripts
C:\ProgramData\Anaconda3\pkgs\pip-19.2.3-py37_0\Scripts>pip install matplotlib
I was having the same issue and it was resolved after I used the CMD.exe Prompt from the Anaconda navigator on Windows 10.
Note that I already had it installed fine through the windows command prompt, outside Anaconda.
I am trying to import following in jupyter notebook.
How do I import module Support_funcions?
from support_functions import calculate_accuracy, plot_confusion_matrix
Populating the interactive namespace from numpy and matplotlib
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-d809bed20d2c> in <module>
20
21 # Support functions import
---> 22 from support_functions import calculate_accuracy, plot_confusion_matrix
ModuleNotFoundError: No module named 'support_functions'
Make sure setup is correct for Python. Add the file for support_functions (support_functions.py question) to the systems python._pth file.
I am sorry for asking this question again, but I could not find any answer to my problem that helped me. I don't have much experience with python. I use python version 3.6.8 on Windows and I have already installed matplotlib, numpy and scipy. The 'pylab.py' file is also contained in the matplotlib folder. Edit: Using matplotlib.pyplot also doesn't work.
Edit: After some more trials I got the error that the module 'six.names" could not be found. The six package has been installed.
import pylab
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pylab
ModuleNotFoundError: No module named 'pylab'
import matplotlib.pyplot
Traceback (most recent call last):
File "<pyshell#21>", line 1, in <module>
import matplotlib.pyplot
File "C:\...\Python36-32\lib\matplotlib\pyplot.py", line 30, in <module>
from cycler import cycler
File "C:\...\Python36-32\lib\cycler\cycler.py", line 48, in <module>
from six.moves import zip, reduce
ModuleNotFoundError: No module named 'six.moves'
Per https://matplotlib.org/faq/usage_faq.html#matplotlib-pyplot-and-pylab-how-are-they-related, pylab is not recommended; you should use pyplot instead.
The correct way to import either is
import matplotlib.pyplot # use this
import matplotlib.pylab # only if you cannot avoid it
(pyplot and pylab are not standalone modules, but submodules of matplotlib.)
when i run python3.7 in pycharm(matplotlib error)
import matplotlib.pyplot as plt
then i get
Traceback (most recent call last):
File "D:/PyCharm 2017.2.3/Workplace/SimpleGA-master/ga.py", line 3, in
<module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
and i tried to find matplotlib in https://pypi.python.org/pypi/matplotlib,but not find python3.7 package
Make sure you have installed the matplotlib modules.
+ pip install matplotlib
Then try again.
Thanks!
I am using python 2.7 with matplotlib 1.4.3. When I try to run a simple program I get this error:
Traceback (most recent call last):
File "C:\Python27\Projects\ImgRecg\img.py", line 3, in <module>
import matplotlib.pyplot
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 105, in <module>
import six
ImportError: No module named six
You need to install the Six module.
pip install six