Skip to content

How to Install NumPy on Ubuntu 24.04

Richard
Written by
Richard
Jan 10, 2025 Updated Mar 20, 2026 3 min read
How to Install NumPy on Ubuntu 24.04

You install NumPy on Ubuntu 24.04 using the APT package manager.

NumPy, short for Numerical Python, is an essential open-source library for Python, powering scientific and numerical computing. It provides powerful tools for working with multi-dimensional arrays and matrices, along with a vast collection of mathematical functions.

This foundational library supports tasks like linear algebra and random number generation, and its core operations, often written in C or Fortran, offer significant speed advantages over standard Python code.

This allows you to perform high-performance numerical computations directly within your Python environment on Ubuntu 24.04.

⚡ Quick Answer

You can install NumPy on Ubuntu 24.04 using the APT package manager. Open your terminal and run sudo apt install python3-numpy. This command installs NumPy and any necessary dependencies from the Ubuntu repositories.

Install Python and Pip

Before we get to NumPy, let’s ensure you have Python installed. You’ll need it to get NumPy up and running. If you haven’t already, run the command below to install Python. You can find more details on installing Python and Pip in the post linked below.

🐧Bash / Shell
sudo apt update && sudo apt upgrade
sudo apt install python3 python3-pip

Install Python and Pip on Ubuntu Linux

NumPy Using APT

The most direct way to install NumPy on Ubuntu is through the Advanced Package Tool (APT). This method installs NumPy directly from the Ubuntu repository, which helps ensure it works smoothly with your current system setup.

Run the command below to install NumPy.

🐧Bash / Shell
sudo apt install python3-numpy

The command above will install any dependencies and NumPy packages.

Install NumPy Using Python Virtual Environment

Another way to install NumPy is by using a Python virtual environment. Using a Python virtual environment keeps your project dependencies separate from other Python installations on your system.

To create a Python virtual environment, run the command below to install Python environment packages.

🐧Bash / Shell
sudo apt install python3.12-venv

Next, create a virtual environment called “myenv” by running the command below.

💻Code
python3 -m venv myenv

Next, activate the environment by running the command below.

💻Code
source myenv/bin/activate

Once the environment is active, you can install the specific version you need. Just replace ‘VERSION‘ with the version number you want.

💻Code
pip install numpy==VERSION

Here’s an example:

💻Code
pip install numpy==1.26.3

After that, import NumPy by running the command below.

💻Code
python3
import numpy as np

Print out the NumPy version by running the command below.

💻Code
print(np.__version__)

Once you’re done, you can deactivate the virtual environment by running the command below.

💻Code
deactivate

And that’s it!

Summary:

Installing NumPy on Ubuntu 24.04 is a manageable process with a few different approaches. Here are the key points to remember:

  • Versatile Library: NumPy is essential for numerical and scientific computing, offering various mathematical functions and support for multi-dimensional arrays.
  • Installation Methods: You can install NumPy using the APT method for ease or create a virtual environment for better project dependency management.
  • Python Requirement: Ensure that you have Python and Pip installed before proceeding with the installation of NumPy.
  • Version Control: Installing NumPy in a virtual environment allows you to manage different library versions easily, which is particularly useful for multiple projects.
  • Verifying Installation: Always verify the installation by checking the NumPy version to confirm that the library is set up correctly.

These steps ensure that NumPy is properly installed and ready for your numerical computing tasks on Ubuntu 24.04.

How do I install NumPy on Ubuntu?

So for this one we need to write the command sudo apt install write here python 3 And after that minus and numpy. So do apt install python 3 minus numpy press Enter. Now give the password.

How to install Python on Ubuntu 24.04 terminal?

Ubuntu 24.04 includes Python 3.12 but does not include pip in the base installation. Install it with sudo apt install python3-pip . For newer Python versions, use python3. 13 -m pip inside a virtual environment.

How to check if NumPy is installed in Ubuntu?

The simplest way I found was to try to build a numpy array and then print it (see code below). If the array prints, numpy is installed, if array doesn't print, numpy is not installed.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

No comments yet — be the first to share your thoughts!

Leave a Comment

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

Exit mobile version