matplotlib Installation and Setup


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.


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.


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.


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 install --user. Typically, this will install matplotlib into ~/.local.


sudo apt-get install python-matplotlib

Fedora/Red Hat

sudo yum install python-matplotlib


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