comprehensive library for creating static, animated, and interactive visualizations in Python
Matplotlib (portmanteau of MATLAB, plot, and library) is a plotting library for the Python programming language and its numerical mathematics extension NumPy. It provides an object-oriented API for embedding plots into applications โ€ฆ Wikipedia
Factsheet
Original author John D. Hunter
Developers Michael Droettboom, et al.
Initial release 2003; 23 years ago (2003)
Factsheet
Original author John D. Hunter
Developers Michael Droettboom, et al.
Initial release 2003; 23 years ago (2003)
๐ŸŒ
Matplotlib
matplotlib.org โ€บ 3.1.1 โ€บ users โ€บ installing.html
Installing โ€” Matplotlib 3.1.2 documentation
If you are on Linux, you might prefer to use your package manager. Matplotlib is packaged for almost every major Linux distribution. Debian / Ubuntu: sudo apt-get install python3-matplotlib
๐ŸŒ
Matplotlib
matplotlib.org โ€บ stable โ€บ install โ€บ index.html
Installation โ€” Matplotlib 3.10.8 documentation
Matplotlib is available both via the anaconda main channel ... If you are using the Python version that comes with your Linux distribution, you can install Matplotlib via your package manager, e.g.:
Discussions

How to install a library (matplotlib)
My guess is that you installed matplotlib in your global python install, but PyCharm uses a virtual python environment per project. If true, you need to install matplotlib in that virtual environment. In the terminal, first make sure your virtual environment is activated. I have never used PyCharm, so I can't give any PyCharm specific help. But if the virtual environment is in a venv/ subfolder of your project folder, you probably just need to write this command in a terminal after cd'ing to the project folder: . venv/bin/activate (Note that the command starts with a dot and a space. This is needed on Linux, and I also assume it is needed on Mac. It is not needed on Windows.) Then install the matplotlib package with this command: python -m pip install matplotlib Do not run pip directly. Sometimes it will work, sometimes it will not. Always run it with the python -m pip command. This ensures that pip is running under your currently active environment and installs packages under that environment. More on reddit.com
๐ŸŒ r/learnpython
5
2
March 16, 2024
python - How to install matplotlib - Stack Overflow
I installed python3.2 in ubuntu (the default edition is not deleted), and I follow the steps in here However when i use python3.2 setup.py install I got: "error: command 'gcc' failed with exit More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to install Matplotlib in Python 3 on Windows - Stack Overflow
Matplotlib tell us that the requirement is Python 2.4 or later but not Python3. Now I'm working with Python3 and I need some plot from Matplotlib. So how do I solve it? More on stackoverflow.com
๐ŸŒ stackoverflow.com
Installing Matplotlib for new users - Installation - Matplotlib
NOTE: You need to install latest ... pip using command โ€œ python -m pip install -U pipโ€ Step 3: Install Matplotlib using command โ€œ python -m pip install -U matplotlibโ€ Step 4: Wait for few...... More on discourse.matplotlib.org
๐ŸŒ discourse.matplotlib.org
0
June 9, 2020
๐ŸŒ
PyPI
pypi.org โ€บ project โ€บ matplotlib
matplotlib ยท PyPI
Matplotlib produces publication-quality figures in a variety of hardcopy formats and interactive environments across platforms. Matplotlib can be used in Python scripts, Python/IPython shells, web application servers, and various graphical user interface toolkits. See the install documentation, which is generated from /doc/install/index.rst
      ยป pip install matplotlib
    
Published ย  Dec 10, 2025
Version ย  3.10.8
Homepage ย  https://matplotlib.org
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ matplotlib_getting_started.asp
Matplotlib Getting Started
If this command fails, then use a python distribution that already has Matplotlib installed, like Anaconda, Spyder etc.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ how to install a library (matplotlib)
r/learnpython on Reddit: How to install a library (matplotlib)
March 16, 2024 -

So I need to install matplotlib for a school project, and I've installed pip on my mac already. I've verified that I installed it on terminal, but now I don't know how to install or use matplotlib. I wrote "pip install matplotlib", and something seemed to be happening. At the end it said successfully installed, but if I write "import matplotlib" in pycharm it doesnt work...

The tutorial websites dont say anything, or at least I couldnt find anything
What do I do?

Top answer
1 of 6
51

Matplotlib supports python 3.x as of version 1.2, released in January, 2013.

To install it, have a look at the installation instructions. In general, call pip install matplotlib or use your preferred mechanism (conda, homebrew, windows installer, system package manager, etc). In some cases you may need to install additional non-python dependencies (libpng and freetype) through your system's package manager.

The answer below is left for historical reasons and as an example of installing the development version from github.


The current release of matplotlib doesn't support python3.

There's a github branch for python3 support for a couple of years now, but it hasn't been stable on anything other than linux until fairly recently. I believe that branch was recently merged back into the main branch.

If you want to use matplotlib on python3, you'll need to build from the current tip https://github.com/matplotlib/matplotlib

To build it, do something similar to the following:

git clone https://github.com/matplotlib/matplotlib
cd matplotlib
python3 setup.py build
sudo python3 setup.py install

If you don't have git installed, then you can just download a tarball of the current git tip instead: https://github.com/matplotlib/matplotlib/tarball/master

You'll need to have numpy installed for python3. (Installing it for python2 doesn't install it for python3.)

In most cases, that's all you'll need to do. For a default install, the only non-included python library is numpy. The other dependencies (e.g. libpng, freetype) are system libraries and if you can build matplotlib for python2, you already have them.

If you want a non-default install (e.g. if you want any of the non-default backends), then you'll need to copy the setup.cfg.default template to setup.cfg and edit it to match what you want. You'll probably only need to do this if you're planning to embed matplotlib in a gtk or qt application that you're writing, in which case you'll want the gtkagg or qtagg backends instead of just the default tkagg backend.

2 of 6
23

just to bump @endolith's comment up to answer level, from at least uBuntu 14-04 linux onwards, matplotlib support for python3 is built-in with apt:

sudo apt-get install python3-matplotlib

should install matplotlib for python3 with the necessary dependencies.

๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ installation guide โ€บ install-matplotlib-python
How to Install Matplotlib on python? - GeeksforGeeks
July 18, 2025 - This will download and install the latest version of Matplotlib from the Python Package Index (PyPI).
Find elsewhere
๐ŸŒ
Alma Better
almabetter.com โ€บ bytes โ€บ articles โ€บ how-to-install-matplotlib-in-python
How to Install Matplotlib in Python with Detailed Steps
May 4, 2025 - If Python is not installed, download ... varies depending on your operating system. To install Matplotlib, you can use Python's package manager, pip....
๐ŸŒ
Matplotlib
matplotlib.org โ€บ stable โ€บ users โ€บ installing โ€บ index.html
Installation โ€” Matplotlib 3.8.4 documentation
May 28, 2023 - Matplotlib releases are available as wheel packages for macOS, Windows and Linux on PyPI. Install it using pip: python -m pip install -U pip python -m pip install -U matplotlib
๐ŸŒ
University of Vermont
uvm.edu โ€บ ~cbcafier โ€บ python-tooling โ€บ matplotlib_mac.html
Installing Matplotlib (macOS) โ€“ Clayton Cafiero
January 5, 2025 - Once this is done, you should see a screen indicating that matplotlib has been installed. Click the button labeled โ€œClose.โ€ ยท In the Python shell (within Thonny) type import matplotlib at the prompt and hit return.
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ matplotlib โ€บ how to install matplotlib in python?
How to Install Matplotlib in Python? - Scaler Topics
April 20, 2024 - Download python from the official website according to your operating system and install it. Next, install Matplotlib using the following PIP command in the command prompt terminal:
๐ŸŒ
Matplotlib
matplotlib.org โ€บ 3.5.2 โ€บ users โ€บ installing โ€บ index.html
Installation โ€” Matplotlib 3.5.2 documentation
Matplotlib releases are available as wheel packages for macOS, Windows and Linux on PyPI. Install it using pip: python -m pip install -U pip python -m pip install -U matplotlib
๐ŸŒ
DevGenius
blog.devgenius.io โ€บ how-to-install-matplotlib-in-python-using-pip-0506826daa3b
How to install matplotlib in Python using pip? | by Let's Decode | Dev Genius
March 4, 2024 - Step 1: Ensure that Python is already ... cmd if you are in the Windows operating system. Step 3: Type the command pip install matplotlib in your system shell/terminal or cmd....
๐ŸŒ
University of Vermont
uvm.edu โ€บ ~cbcafier โ€บ python-tooling โ€บ matplotlib_windows.html
Installing Matplotlib (Windows) โ€“ Clayton Cafiero
January 5, 2025 - Once this is done, you should see a screen indicating that matplotlib has been installed. Click the button labeled โ€œClose.โ€ ยท In the Python shell (within Thonny) type import matplotlib at the prompt and hit return.
๐ŸŒ
Matplotlib
matplotlib.org โ€บ 1.4.3 โ€บ faq โ€บ installing_faq.html
Installation โ€” Matplotlib 1.4.3 documentation
If, for some reason, you can not use the package manager, Linux usually comes with at least a basic build system. Follow the instructions found above for how to build and install matplotlib. Apple ships OS X with its own Python, in /usr/bin/python, and its own copy of matplotlib.
๐ŸŒ
Matplotlib
discourse.matplotlib.org โ€บ community โ€บ installation
Installing Matplotlib for new users - Installation - Matplotlib
June 9, 2020 - NOTE: You need to install latest ... -m pip install -U pipโ€ Step 3: Install Matplotlib using command โ€œ python -m pip install -U matplotlibโ€ Step 4: Wait for few......
๐ŸŒ
Matplotlib
matplotlib.org โ€บ 2.2.0 โ€บ users โ€บ installing.html
Installing โ€” Matplotlib 2.2.0 documentation
If you are on Linux, you might prefer to use your package manager. Matplotlib is packaged for almost every major Linux distribution. Debian / Ubuntu: sudo apt-get install python3-matplotlib
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ how-to-install-matplotlib-in-python
How to install matplotlib in Python?
August 31, 2023 - If python is successfully installed, the version of python installed on your system will be displayed. ... The version of pip will be displayed, if it is successfully installed on your system. Matplotlib can be installed using pip.