6

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?

Emerson
  • 797
  • 2
  • 7
  • 12

5 Answers5

16

you can install by pip install matplotlib

Make sure that you already installed setuptools, numpy, python-dateutil, pytz, pyparsing, and cycler before that.

Vinoth Krishnan
  • 2,925
  • 6
  • 29
  • 34
gvr
  • 161
  • 1
  • 4
  • hi, I installed all the tools you listed from `setuptools` to `cycler` and then I did `pip install matplotlib` but I get this error `Command "python setup.py egg_info" failed with error code 1`. Any ideas? – Parth Bhoiwala Sep 29 '16 at 13:13
  • I executed `pip install --upgrade setuptools` from a command prompt with administrator rights and after that `pip install matplotlib` worked fine for me – Bert Regelink Feb 19 '18 at 09:55
9

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

joaquin
  • 82,968
  • 29
  • 138
  • 152
  • And to update MPL on windows, see http://matplotlib.org/faq/installing_faq.html (bottom of the page). – Pat Feb 20 '13 at 19:34
0

If you are installing matplotlib under windows using anaconda. Here are the steps..

I am using Anaconda 1.8.7

  1. Goto your Anaconda Navigator and choose Environments
  2. Click on the arrow and choose Open terminal
  3. 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

Rajiv Nair
  • 21
  • 3
0
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

edvaldig
  • 2,301
  • 16
  • 17
-1

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