matplotlib Installation and Setup


Example

There are several ways to go about installing matplotlib, some of which will depend on the system you are using. If you are lucky, you will be able to use a package manager to easily install the matplotlib module and its dependencies.

Windows

On Windows machines you can try to use the pip package manager to install matplotlib. See here for information on setting up pip in a Windows environment.

OS X

It is recommended that you use the pip package manager to install matplotlib. If you need to install some of the non-Python libraries on your system (e.g. libfreetype) then consider using homebrew.

If you cannot use pip for whatever reason, then try to install from source.

Linux

Ideally, the system package manager or pip should be used to install matplotlib, either by installing the python-matplotlib package or by running pip install matplotlib.

If this is not possible (e.g. you do not have sudo privileges on the machine you are using), then you can install from source using the --user option: python setup.py install --user. Typically, this will install matplotlib into ~/.local.

Debian/Ubuntu

sudo apt-get install python-matplotlib

Fedora/Red Hat

sudo yum install python-matplotlib

Troubleshooting

See the matplotlib website for advice on how to fix a broken matplotlib.