UbuntuUbuntu Based

How To Install Numpy on Ubuntu 24.04 LTS

Install Numpy on Ubuntu 24.04

In this tutorial, we will show you how to install Numpy on Ubuntu 24.04 LTS. NumPy, short for Numerical Python, is an open-source library that adds support for large, multi-dimensional arrays and matrices, along with a vast collection of high-level mathematical functions to operate on these arrays. It is widely used in various scientific and engineering domains, including linear algebra, Fourier analysis, and random number generation.

With NumPy, you can perform complex mathematical operations on entire arrays or matrices with a single command, making it an indispensable tool for scientific computing, data analysis, and machine learning tasks. Its efficient implementation and integration with other libraries like SciPy and Matplotlib make it a must-have for any Python developer working in these fields.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Numpy on Ubuntu 24.04 (Noble Numbat). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.


  • A server running one of the following operating systems: Ubuntu and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies.
  • An Ubuntu 24.04 system with root access or a user with sudo privileges.

Install Numpy on Ubuntu 24.04 LTS Noble Numbat

Step 1. Updating the Package Repository.

It’s always a good practice to keep your system up-to-date before installing new packages. Run the following commands to update your package lists and upgrade any existing packages:

sudo apt update
sudo apt upgrade

Step 2. Installing Python.

NumPy requires Python to be installed on your system. Ubuntu 24.04 comes with Python 3.12 pre-installed, but you can verify it by running python3 --version in your terminal. If Python is not installed, you can install it using the following command:

sudo apt update
sudo apt install python3

Step 3. Installing Numpy on Ubuntu 24.04.

With the prerequisites out of the way, you can now proceed to install NumPy on your Ubuntu 24.04 system. There are several methods to accomplish this, and we’ll cover the two most common approaches.

  • Method 1: Installing NumPy via pip

The recommended way to install NumPy is through the Python Package Installer (pip). Follow these steps:

First, upgrade pip to the latest version by running:

python3 -m pip install --upgrade pip

Install NumPy by executing the following command:

python3 -m pip install numpy

This command will download and install the latest stable version of NumPy from the Python Package Index (PyPI).

  • Method 2: Installing NumPy via apt

Alternatively, you can install NumPy directly from the Ubuntu repositories using the Advanced Packaging Tool (apt). However, keep in mind that the version available in the repositories may not be the latest, as Ubuntu prioritizes stability over the newest releases.

Install NumPy by executing the following command:

sudo apt install python3-numpy

This command will install NumPy and any required dependencies from the Ubuntu repositories.

After installing NumPy, it’s a good idea to verify that the installation was successful. You can do this by running a simple Python script that imports and uses the NumPy library.

Open a text editor and create a new file called test_numpy.py.

nano test_numpy.py

Add the following code to the file:

import numpy as np

a = np.array([1, 2, 3, 4, 5])

Save the file and exit the text editor, then navigate to the directory where you saved the test_numpy.py file, and run the following command:

python3 test_numpy.py

If the installation was successful, you should see the following output:

[1 2 3 4 5]

This output confirms that NumPy is installed correctly and ready to be used in your Python projects.

Congratulations! You have successfully installed Numpy. Thanks for using this tutorial for installing the Numpy on the Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the Numpy website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button