Install Numpy on Ubuntu 22.04 Jammy Jellyfish Linux

NumPy is a Python library, which supports large, multi-dimensional arrays and matrices. It also offers a wide set of high-level mathematical functions to operate on these arrays. The objective of this short guide is to install NumPy on Ubuntu 22.04 Jammy Jellyfish Linux.

In this tutorial you will learn:

  • How to install Numpy from the Ubuntu repository
  • How to install Numpy using pip or pip3 commands
  • How to upgrade Numpy to its latest version
Numpy on Ubuntu 22.04 Jammy Jellyfish Linux
Numpy on Ubuntu 22.04 Jammy Jellyfish Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Ubuntu 22.04 Jammy Jellyfish
Software Python 3, NumPy
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Install Numpy on Ubuntu 22.04 step by step instructions



Install Numpy from Ubuntu repository

  1. To get started, open a command line terminal. Then, to install Numpy on Ubuntu 22.04 Jammy Jellyfish execute the following apt commands.
    $ sudo apt update
    $ sudo apt install python3-numpy
    
  2. Check NumPy version to verify installation with the following command:
    $ python3 -c "import numpy; print(numpy.__version__)"
    1.21.5
    

Install Numpy using pip3 command

  1. Given that you have already installed Python installer pip on you Ubuntu 22.04 host, you can now easily install numpy by using the pip3 command:
    $ pip3 install numpy
    
  2. Check NumPy version to verify installation with the following command:
    $ python3 -c "import numpy; print(numpy.__version__)"
    1.21.5
    

Upgrade numpy to latest version

In case you have installed numpy from the Ubuntu repository you can upgrade it by simply executing the following Linux commands:

$ sudo apt update
$ sudo apt install python3-numpy

Execute the below command, in case you need to upgrade numpy to the latest version with pip3:

$ pip3 install --upgrade numpy

Closing Thoughts




In this tutorial, you learned how to install NumPy via the default Ubuntu repository or from pip, the Python package manager. You also saw how to keep the NumPy library up to date. After installation, you can use the NumPy libaray in your future Python programs.