Handy Methods to Install Packages and Access Their Information in the Jupyter Notebook

To introduce different and convenient methods to install packages and check their information directly in the Jupyter notebook rather than in the terminal

Normally we install a Python package and check its version and detailed information in Windows CMD, PowerShell, Anaconda prompt, or Terminal. If you like Jupyter notebook or JupyterLab, you can install a package directly in a Jupyter notebook and access information of the installed packages.

1. Install a Package

The first method to install a package using the following command:

!pip install <PackageName>

This is the traditional and also widely used method to install a package directly in a Jupyter notebook. For example, let’s install Matplotlib.

!pip install matplotlib

Actually, we can also %pip magic or just pip to install a package in the Jupyter notebook.

%pip install matplotlib


pip install matplotlib

For Anaconda users, it can also use conda install <packagename> to install a package directly in a Jupyter notebook. We just change the pip to conda in the above methods.

2. Access Package Information

(1) Method 1: __version__ attribute

Normally, we can get the version of installed package using __version__ attribute. For example, to check the version of Matplotlib installed in your computer, you can use the following Python script in the Jupyter notebook.

import matplotlib as plt

It just prints the version number, for example, in my computer:


(2) Method 2: pip list

We can use pip list to display a list of all installed package names and version numbers. If we only list the certain package, such as Matplotlib, we can use the following script.

On Window system:

pip list | FINDSTR matplotlib

On Linux System:

pip list | grep matplotlib

The result looks as follows:

For Anaconda users, you can use conda list. For example:

conda list matplotlib

It produces the following result:

(3) Method 3: pip show

The third method is to use pip show to get further information, including the package versions.

!pip show matplotlib

Or you can use one of the following command:

%pip show matplotlib
pip show matplotlib

We obtain the following results:

(4) Method 4: help( )

We can use help() method to get even more information about a package in the Jupyter notebook.

First we type


We get the following information:

Then we need to type the package name, for example Matplotlib again. The very detailed information about this package will be generated.

3. Online course

If you are interested in learning Jupyter notebook in details, you are welcome to enrol one of my cours Practical Jupyter Notebook from Beginner to Expert.

0 - 0

Thank You For Your Vote!

Sorry You have Already Voted!

Please follow and like me:

Leave a Reply

Your email address will not be published. Required fields are marked *