How to Install NumPy on Ubuntu 24.04
NumPy is a free Python library that handles heavy math and science calculations on Ubuntu 24.04. It lets you work with large grids of numbers and fast mathematical functions without slowing down your computer.
Python programs run complex number crunching much faster with this package installed because the core parts use C and Fortran code behind the scenes. Data analysis and scientific projects rely heavily on this speed boost to process information quickly.
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
Python and Pip are required prerequisites for installing NumPy on Ubuntu 24.04, and terminal commands fetch both dependencies.
sudo apt update && sudo apt upgrade
sudo apt install python3 python3-pip
NumPy Using APT
Retrieving NumPy from official Ubuntu software sources via APT offers the most direct deployment path.
Execute this command to install NumPy:
sudo apt install python3-numpy
The package manager resolves all required dependencies automatically during this process.
Install NumPy Using Python Virtual Environment
Isolated Python virtual environments maintain project organization and prevent package version conflicts on Ubuntu 24.04. Installing the virtual environment tool via 'sudo apt install python3.12-venv' prepares the system for dedicated workspace creation.
Run this command to install the required Python environment packages:
sudo apt install python3.12-venv
Create a dedicated virtual environment named myenv for your project next:
python3 -m venv myenv
Activation makes the isolated workspace active in the terminal session.
source myenv/bin/activate
Specific package versions install successfully inside active environments.
pip install numpy==VERSION
Implementation follows this pattern:
pip install numpy==1.26.3
Test the module import afterward to confirm proper installation.
python3
import numpy as np
Output the installed version string with this execution:
print(np.__version__)
Deactivating the virtual environment returns the terminal to the global system state.
deactivate
Configuration finishes here.
Summary:
Multiple deployment methods exist for adding NumPy to Ubuntu 24.04 systems. Core takeaways include:
- 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.
Numerical computing tasks on Ubuntu 24.04 execute reliably once these configuration steps complete.
How do I install NumPy on Ubuntu?
Run the following command to install the package: sudo apt install python3-numpy. Enter account credentials when prompted by the terminal.
How to install Python on Ubuntu 24.04 terminal?
Ubuntu 24.04 includes Python 3.12 without bundled pip packages in default configurations. Add it using sudo apt install python3-pip. Newer Python releases require python3.13 -m pip execution inside virtual environments.
How to check if NumPy is installed in Ubuntu?
Building and printing a test array via the code snippet below verifies functional installation status. Successful console output confirms the library works, while errors indicate missing packages.
Was this guide helpful?
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!