Installing Matplotlib in Python

In this Python tutorial we will discuss various methods for installing matplotlib. There are atleast 4 ways we can install matplotlib in Python, listed below:

  1. Installation using pip
  2. Installing matplotlib in Linux
  3. Installing matplotlib using GitHub
  4. Installation on Conda

Installation using Pip

Use the following command to download the official version of matplotlib using the pip package manager.

pip install matplotlib

If you face any error, it’s likely due to the fact that you are not executing this command in the directory where the Python installation was done. You can learn more about this problem by checking out our getting started with Python Guide.


Installing matplotlib in Linux

Commands that you can use in the various Linux distributions to download matplotlib.

Ubuntu:

sudo apt-get install python3-matplotlib

Fedora:

sudo dnf install python3-matplotlib

Red Hat:

sudo yum install python3-matplotlib

Arch:

sudo pacman -S python-matplotlib

Installing matplotlib using GitHub

This method involves directly grabbing the files from the GitHub repo where matplotlib is developed. You will however, have to make sure you have the required dependencies.

Using this method will also give you access to the latest developers version of matplotlib.

Using the HTTPS link:

git clone https://github.com/matplotlib/matplotlib.git

or using SSH:

git clone git@github.com:matplotlib/matplotlib.git

To get new updates made to the GitHub repo, use the following command to pull the new changes.

git pull

Installation on Conda

Matplotlib install command for the Anaconda main channel.

conda install matplotlib

If you weren’t able to find an answer to your problem in this tutorial, or if you are facing some other issues regarding the installation of matplotlib, refer to the official matplotlib website.


This marks the end of the Installing Matplotlib in Python Tutorial. Any suggestions or contributions for CodersLegacy are more than welcome. Questions regarding the tutorial content can be asked in the comments section below.

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments