Trouble installing 'matplotlib' - python

Cant' install 'matplotlib.pyplot' on Windows 10, Python 3.7
I tried 'pip install matplotlib.pyplot' and received an error
Here's the exact error code:
Could not find a version that satisfies the requirement matplotlib.pyplot (from versions: )
No matching distribution found for matplotlib.pyplot

Don't use pip install matplotlib.pyplot, use pip install matplotlib
matplotlib.pyplot is calling pyplot from the module matplotlib. What you want is the module, matplotlib. Then from idle or wherever you are running this, you can call matplotlib.pyplot

Try just using pip install on your command line (or terminal):
'pip install matplotlib'
I hope it helps.
BR

Related

I can't get Seaborn to import

I'm trying to add Seaborn to my Anaconda3 python installation, and get multiple failure codes. It successfully installed using conda ... but won't import. After multiple installs/deletion/reinstalls of scipy, numpy, and seaborn, I get the following error message. I'm running Python 3.9.12, numpy 1.22.0 (downgraded from 1.23 due to prev error message stating had to be < 1.23 for Seaborn to install -- on a Windows 10. Any suggestions would be appreciated.
I can't post an image yet, so here's a summary of the error message with the failure points
code:
import Seaborn as sns
ImportError
...
import seaborn as sns
from .rcmod import * # noqa:F401, F403
from .import palettes
from . import _arpack
ImportError: DLL load failed while importing _arpack: The specified procedure could not be found.
It is not issue of seaborn. First of all uninstall numpy using this command
pip uninstall -y numpy
Then uninstall setuptools with this command
pip uninstall -y setuptools
Now, reinstall setuptools with this command
pip install setuptools
Then, You can reinstall numpy with this command
pip install numpy
Now, Your error must be solved.

No module named 'numpy' but Requirement already satisfied: numpy

When I want to execute my script I got the error: ModuleNotFoundError: No module named 'numpy'. But the module is already installed as said me the answer to the install command:
C:\WINDOWS\system32>pip install numpy
Requirement already satisfied: numpy in c:\users\simeo\anaconda3\envs\tensorflow1\lib\site-packages (1.17.2)
I'm quite new with Python, so I don't understand why it's not working and what could be the problem.
I'm using Windows 10 (64 bits). I installed Python 3.7
Thanks in advance!
For Windows try either two of these methods in cmd:
pip3 install numpy
pip3 install -U numpy
directly download latest version from sourceforge.net
If you are using pycharm, it can not install numpy from interpreter settings. After one of above method works, try installing numpy in pycharm again through interpreter settings.
You need to upgrade your Numpy library. Your current Keras version is not compatible with your Numpy module. You can use the below-given command to upgrade Numpy.pip install -U numpy
Try adding this to your code, above everything else:
import numpy

ModuleNotFoundError: No module named 'spatial'

I've been faced to Module Not Found Error in a script which all it's requirements has been installed. I'm trying to import spatial library:
import spatial
This library is located here:
C:\Users\ASUS\AppData\Local\Programs\Python\Python37\Lib\site-packages\scipy\spatial
I checked installed packages through pip list and it was okay. I tried to install spatial-lib in Pycharm project environment but it couldn't be done:
Could not find a version that satisfies the requirement spatial-lib (from versions: )
No matching distribution found for spatial-lib
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
It's nonesence, because my pip is up-to-date. Maybe good to say, importing scipy has such probelms too.
It looks like spatial is a sub-package of scipy. Therefore, to import spatial, you should use the following:
from scipy import spatial

get Error: 'no module named 'matplotlib.style' while matplotlib works fine

I'm using PyCharm on an ubuntu 14.04.1 LTS with python3. I want to use the 'ggplot' style module, but I get an 'no module named' error. Matplotlib 1.3.1 is installed and works fine (I updated it recently).
import matplotlib as mpl
import matplotlib.style as mplstyle
mplstyle.use('ggplot')
ImportError: No module named 'matplotlib.style'
I also checked for the matplotlibrc file and matplotlibtool and everything seems to be as the documentation recommends. Anyone knows, what I can do?
According to What's new in matplotlib, the style package was added to matplotlib since version 1.4.
So, check your matplotlib version by,
$ pip freeze | grep matplotlib
matplotlib==1.3.1
Upgrade matplotlib to the newest version by,
$ sudo pip install matplotlib --upgrade
$ pip freeze | grep matplotlib
matplotlib==1.5.1
This works fine for me.
import matplotlib.pyplot as plt
plt.style.use('ggplot')

Installing matplotlib under Windows

I'm trying to install matplotlib under Windows Vista. Both python itself and numpy are working for me.
I installed matplotlib via the executable basemap-1.0.2.win32-py2.7 and followed the official instructions. But running from matplotlib import * gives me the following error:
No module named matplotlib
Any ideas how to get matplotlib working?
you can install by pip install matplotlib
Make sure that you already installed setuptools, numpy, python-dateutil, pytz, pyparsing, and cycler before that.
basemap is not the installer for matplotlib.
basemap is a library of the matplotlib toolkit for plotting 2D data on maps, you need to indepently install matplotlib to use it.
You can get matplotlib from here
from pylab import *
This works on a proper the default scipy/pylab/matplotlib setup. And to get you started:
> hist(randn(10000))
> show()
Matplotlib is a part of the pylab suite
If you are installing matplotlib under windows using anaconda. Here are the steps..
I am using Anaconda 1.8.7
Goto your Anaconda Navigator and choose Environments
Click on the arrow and choose Open terminal
Type conda install matplotlib
That should do the trick. For specific versions and to install onto specific environments within annaconda you can utilise the = and -n / name option
https://conda.io/docs/commands/conda-install.html
Matplotlib Installation using command prompt / Annaconda Terminal
Open Command Prompt
C:\Users\Uname>python -m pip install matplotlib
Matplotlib requires some of the following dependencies:
FreeType libpng NumPy setuptools cycler dateutil kiwisolver pyparsing

Categories