Programming3 min read

How to Install Matplotlib package in Python?

Abhishek Ahlawat

By Abhishek Ahlawat — Recently

Founder of StudyTonight and a MERN fullstack developer. Writes about JavaScript, web development, Linux, and tech.

#machine-learning#python#matplotlib#howto

Summarize this article using AI

Matplotlib is a package in Python that is used in Data Science to create informative charts and graphs to represent data visually. Matplotlib is one of the most popular packages in Python.

If you want to learn Matplolib, you should check our free reading tutorials: Matplotlib Tutorial

There are many different ways to install Matplotlib. In this article, I will cover two different ways to install Matplotlib. The first one using pip installer, and the second one uses Anaconda.

So let's jump right in.

Get Done with it!

If you just need the command to install the Matplotlib package with no additional information, just run the command below:

python -m pip install -U pip
python -m pip install -U matplotlib

I hope that works fine for you. If you want to understand what you just did. Just follow along till the end of this article.

Install Pip and Matplotlib

You must have Python 3.x installed on your system to install Matplotlib. If you do not have Python installed, do not worry, this tutorial will guide you on how to install Python on your local system.

Python installation brings along pip with it. If you have Python installed already then you can upgrade the version of pip, by running the following command:

pip install pip –upgrade

Now we are ready to install Matplotlib.

Install Matplotlib

Matplotlib package is officially distributed in the form of a Matplotlib Wheel file. You can install Matplotlib on macOS, Windows, or Linux system using the pip command.

Just run the following command:

python -m pip install -U matplotlib

You can find all the details about the Matplotlib package here: https://pypi.org/project/matplotlib/

This will install the Matplotlib package on your system. If you face any trouble installing the Matplotlib package this way, then you can try using Anaconda.

Install Matplotlib on Anaconda

If you are familiar with or already using Anaconda, then follow the below steps to install the Matplotlib package. (Even if you do not know about Anaconda, try downloading it and setting it up, follow this link for that.)

The Matplotlib package is available as conda package. If you want to list and see all the conda packages installed on your system, you can run the following command:

conda list

If you do not see Matplotlib listed, that means the default Anaconda installation didn't bring the Matplotlib module along. (some versions do include the Matplotlib module by default). Run the following command to install it:

conda install matplotlib

And you are done.

Spotted something outdated or wrong?

Liked this? See more StudyTonight posts in Google results.

Add StudyTonight as a preferred source
Next questLIVE OPSStep 2 / 3

Practice real incidents in the browser

System Design Ops — put out fires, ship fixes, and stack XP. Reading done. Time to play.

Play System Design
  • +XP

    Every sim

  • Incidents

    Live ops

  • Ranks

    Climb up

Read next