Matplotlib is one of the most popular Python libraries for creating static, animated, and interactive visualizations. Whether you want to make simple line plots or complex heatmaps, Matplotlib provides the tools you need.
In this article, we’ll walk through everything you need to know to install Matplotlib in Windows. Get Matplotlib up and running on your system.
Before installing Matplotlib, make sure you have Python installed (version 3.7 or higher recommended). A command-line interface is also required, in this case, Command Prompt on Windows. Internet connection will also be mandatory to download packages.
Read: How To Install Jupyter Notebook
Install Matplotlib In Windows
You can use pip, Anaconda, or Jupyter Notebooks to install matplotlib. pip is the standard package manager for Python that can be use to download, update and manage the standard package libraries. Follow these steps to install matplotlib using pip:
First, ensure you have the latest version of Python installed on your computer. If you haven’t, here’s how.
The next thing to do, verify whether you have the matplotlib module to do this, type IDLE in the search bar of your computer an hit the Enter key. Integrated Development and Learning Environment (IDLE) enables you to run your Python programs.

Inside IDLE, type import matplotlib then press Enter. If an error is returned, then it means that matplotlib is not installed. Close IDLE if this is the case to proceed to the next step.

It’s also a good idea to have the latest pip. To verify the version of Python you’re running, type cmd in your computer’s search bar and press enter or select Run as Administrator.

Here, enter the command, python –version and hit enter. As at May 2025, the latest version should return Python 3.13.3.

In the next command line, type pip install matplotlib and press Enter.

Give the package a few moments to install. You should receive a message that matplotlib has been successfully installed.

Launch IDLE once more and type import matplotlib then press Enter. If the line plot shows up without errors, you’re good to go. It means that your Matplotlib is installed properly and working correctly.

Troubleshooting Common Errors
ModuleNotFoundError: No module named ‘matplotlib’ – Make sure you installed it in the same environment/interpreter you’re running. Check for multiple Python installations – which python vs. which pip.
Backend-related errors (e.g., “_tkinter not found”): Matplotlib uses different “backends” to display graphs. If you get errors about missing GUI toolkits:
On Linux: install system packages like python3-tk (for TkAgg) or python3-qt5 or switch to a non-interactive backend by adding at the top of your script:
python
Copy
Edit
import matplotlib
matplotlib.use(‘Agg’)
This writes files (e.g., PNG) instead of opening windows.
Permission errors on install: Avoid using sudo pip install. Instead, use a virtual environment or Conda environment.
Slow imports or large dependencies: If you only need basic plotting, consider installing the minimal version of Matplotlib:
bash
Copy
Edit
pip install matplotlib-base
You can also use lightweight plotting libraries like Plotext for terminal plots.
Watch: Install Jupyter Notebook