How to Install NumPy in Python in 5 Easy Steps

Try this guide with our instant dedicated server for as low as 40 Euros

Install NumPy

NumPy, short for Numerical Python, is a free and open-source Python library for numerical scientific computations. It is widely used in data analytics and machine learning projects where you need a reliable codebase for complex numerical and array calculations.

However, before you start using NumPy in your Python projects, you need to install the library on your system.

In this short tutorial, we’ll present a comprehensive process of installing NumPy in Python. Note that the process we’ll discuss below can be applied to any operating system (Windows, macOS, or Linux) with slight modifications.

Table of Contents

  1. Install NumPy in Python in 5 Steps
    1. Prerequisites
    2. Step #1: Launch the Terminal/Command Prompt
    3. Step #2: Verify Python Installation
    4. Step #3: Update Pip
    5. Step #4: Install NumPy in Python
    6. Step #5: Verify NumPy Installation
  2. How to Use the NumPy Package
  3. How to Upgrade NumPy
  4. How to Uninstall NumPy
  5. Conclusion
  6. FAQs

Install NumPy in Python in 5 Steps

The best part about installing NumPy is the flexibility of the process that even movies can follow to set the library for Python projects.

Let’s see what you need before starting installation.


You’ll need the following to install NumPy in Python:

  • You need Python on your system.
  • You should have sudo privileges and access to the terminal/command prompt.

Here’s a step-by-step guide to help you get NumPy up and running on your computer:

Step #1: Launch the Terminal/Command Prompt

Start by launching the terminal on Linux and macOS or the Command Prompt (cmd) on Windows.

Step #2: Verify Python Installation

Step #2 Verify Python Installation

Before installing NumPy, you should verify that Python is available on your system.

For this, the best way is to print out version information. Since you already have the terminal open, enter one of the following commands:

# python --version # checks the default Python version on your system.


# python3 --version # usually checks the Python version on modern systems.

This step ensures compatibility with the NumPy version you intend to install.

If you don’t see version information, you first need to install it by following our Python installation guide.

Step #3: Update Pip

Step #3 Update Pip

Many experts consider this step optional, but we recommend updating pip (package installer for Python), the package manager for installing and updating Python libraries and packages.

Please note that pip doesn’t come pre-installed on most operating systems. You’ll have to install it, ensuring it matches the installed Python version. Once you install it, you can smoothly handle the setup of Python packages, including Numpy.

If you’re on Windows, we recommend our guide to installing pip on Windows. Alternatively, you can follow our guide to installing pip on macOS.

Ubuntu systems come with Python pre-installed, but they do not have pip. If that’s the case with your system, we recommend installing it by downloading get-pip.py from bootstrap.pypa.io and running it with Python.

You can also refer to our easy guide on installing Python pip on Ubuntu 20.04.

After installing pip, you must verify its version to verify if it is successfully installed.

Type pip -V or pip3 -V in the terminal.

After installation, you should update pip to ensure you’re using the latest version. For this, run the following command to update pip:

# python -m pip install --upgrade pip


# python3 -m pip install --upgrade pip

The output of these commands is as follows:

Step #4: Install NumPy in Python

Step #4 Install NumPy in Python

With Python and pip ready, let’s install NumPy using the pip package installer.

Start by entering the following command in the terminal:

# pip install numpy

This command fetches the latest version of NumPy and installs it on your system.

This command works on all operating systems except Fedora. On Fedora, the specific python3 command to install NumPy is:

# python3 -m pip install numpy

Alternate Methods to Install NumPy

By Using Anaconda

Besides pip, you can install NumPy using Anaconda, another Python package manager that includes NumPy and other scientific computing libraries.

  • Download Anaconda from its official website and install it.
  • Once installed, you can install NumPy either through Anaconda Navigator or by running conda install Numpy in the terminal.

Build and Install From Source

Another method is to build the pip package from the source, which is more complex and generally recommended for expert users.

Step #5: Verify NumPy Installation

Step #5 Verify NumPy Installation

After installation, you should verify NumPy installation by running:

# pip show numpy

The output will verify the installation of NumPy, indicating the version in use and the location where the package is stored.

Alternatively, we recommend the following command that outputs a more concise version of the information:

# python -c "import numpy; print(numpy.__version__)"

This command should return the installed version of NumPy without any errors, as shown below:

NumPy without any errors

How to Use the NumPy Package

Once you have installed Numpy, you can use it in your projects.

For this, simply import it at the beginning using the import command in your Python code:

How to Upgrade NumPy

Upgrading NumPy is essential to access the latest features, bug fixes, and performance improvements. Regular upgrades ensure you can use the latest functions and library features for adding more robust and efficient numerical computing capabilities to your Python projects.

Upgrade an existing NumPy installation with this command:

# pip install numpy --upgrade

How to Uninstall NumPy

How to Uninstall NumPy

If you need to remove NumPy from your system, enter the following command in the terminal:

# pip uninstall numpy

This command completely removes NumPy from your system.

Also Read: Add Elements to Python Array: 3 Methods Inside!


Installing NumPy is a straightforward process that helps you perform advanced numerical computations in Python. This guide covered how to install Numpy in Python in 5 easy steps. We also discussed how to upgrade or uninstall your Numpy library.

RedSwitches offers the best dedicated servers pricing and delivers instant dedicated servers, usually on the same day the order gets approved. Whether you need a dedicated server, a traffic-friendly 10Gbps dedicated server, or a powerful bare metal server, we are your trusted hosting partner.


Q. What is NumPy, and why is it a popular package for the Python programming language?

NumPy is an open-source Python library widely used for numerical computing. It’s popular in the Python programming community due to its efficiency in handling large arrays and its rich collection of mathematical functions.

Q. Do I need to uninstall an older version of NumPy before upgrading?

No, using # pip install numpy –upgrade will automatically upgrade your NumPy to the latest version.

Q. Is NumPy compatible with all versions of Python?

NumPy is compatible with most modern versions of Python, but it’s always best to check the NumPy documentation for version compatibility.

Q. Can I use NumPy on any operating system?

NumPy is cross-platform and can be installed on Windows, macOS, and Linux.

Q. Why should I use a virtual environment to install NumPy?

Using a virtual environment allows you to manage dependencies and versions of packages, like NumPy, specific to each project without affecting other projects or the global Python installation.

Q. Do I need to set up any specific environment variables for NumPy?

Generally, no specific environment variables need to be set for NumPy. However, ensure that your Python environment variable is set correctly to run Python scripts and use pip for installation.

Q. Can I consider NumPy as an open-source library, and what are its benefits?

NumPy is an open-source library. This means it’s freely available for use and modification. Its open-source nature promotes community collaboration, ensuring continuous improvement and updates.

Q. Can I install external packages like NumPy for any Python type?

You can install external packages like NumPy for different Python types or versions as long as they are compatible. NumPy typically supports most modern Python versions, but it’s always recommended to check the specific compatibility for the NumPy version you want to install.

Q. What should I do if I get an error message when installing NumPy?

If you encounter an error message during the installation of NumPy, first check your Python and pip versions to ensure compatibility. Also, ensure that your internet connection is stable. If the problem persists, searching for the specific error message online can often provide helpful troubleshooting tips.

Q. Is it possible to install NumPy from the source code?

Yes, it is possible to install NumPy from its source code. This method is typically used when you need a version of NumPy that’s different from the ones available via pip or if you want to contribute to its development. You can download the source code from NumPy’s official website or GitHub repository and follow the instructions provided for installation.

Try this guide with our instant dedicated server for as low as 40 Euros