What is NumPy Package and How to Install it?

Photo of author

By admin

Python refers to the integrated high-level general-purpose programming language with an emphasis on code readability i.e. identifying what the code is doing. Out of the many lucrative features of the Python programming language, a major feature is Python packages.

Several python packages can be installed by the users as per their preference and requirements. Python packages refer to the directory or the library that consists of python scripts. One such highly used python package is ‘NumPy’.

What is the NumPy Package?

NumPy refers to the open-source library for scientific computing in Python used by developers to work with matrices and arrays, especially multidimensional arrays and the derived objects, including masked arrays. NumPy helps developers to execute fast operations on arrays as input for the following operations:

  1. Logical operations
  2. Mathematical
  3. Sorting, and selecting
  4. I/O
  5. Basic linear algebra
  6. Simulation, and many more

Now, the question of greater concern is how to install the NumPy. So, in the next sections, we are going to detail the stepwise procedure to install the NumPy and the system requirements for doing so.

System Requirements for Installing NumPy

Before starting NumPy installation, the users need to fulfill certain prerequisites. Failing to meet these requirements will result in some errors. The prerequisites for installing the NumPy package are as follows:

  1. The updated version of the operating system.
  2. A version of Python installed and ready-to-use.
  3. Identify the version of the Python software installed on the device.
  4. A properly working cmd or terminal.

Steps to Install the NumPy Package

1. Check the Version of Python Installed On the System

Before installing NumPy, users need to check the version of Python they have on their device. In some systems, the programming language environment comes pre-installed. This is not the case with Windows though, so, here, the users need to install Python manually.

The latest version of Python is Python 3, however, Python 2 is also used widely. To determine the version of the Python software, enter the following commands to the terminal window or command-line:

(Important note: whenever you type a command within the terminal window or command line, press the ‘Enter’ key to complete its execution)

  • For Python 2: python –V (this will display the version in number as output)
  • For Python 3: python3 –V

2. PIP Installation

The easiest way of installing the NumPy library is by using pip, the default package manager responsible for maintaining and installing the software packages associated with the Python programming language.

Although pip comes pre-installed with Python, you can install it if it isn’t there. To install the default package manager, enter the following commands in the CMD:

  • For Pip (Python 2)

sudo apt install python-pip

  • For Pip (Python 3)

sudo apt install python3-pip

Both these commands are used along with the strong utility i.e. <strong> apt </strong>.

Once installation of pip is complete, enter the following command to verify whether the installation is successful or not:

  • <strong> pip –V</strong>


  • <strong> pip3 –V</strong>

3. Install NumPy

After the successful installation of pip, the system is ready for the installation of the NumPy library. To do so, utilize the commands detailed below within the terminal or cmd:

  • For installing NumPy for Python 2:

pip install NumPy

(This command ensures the download of the NumPy package through Pip and on its successful installation, the notification alert gets displayed on the screen).

  • For installing NumPy for Python 3:

pip3 install NumPy

4. Verification of the NumPy Installation

The verification process ensures that the NumPy library has been successfully installed on the device or that NumPy is now part of Python. To verify, use the commands as shown below:

  • For Pip2 type:

pip show numpy

  • For Pip3 type:

pip3 show numpy

The output of these commands will be a version of the NumPy along with the location where it has been installed, successfully.

5. Import of Packages Associated With NumPy

The import of packages associated with NumPy is one of the important steps, once the installation gets completed and set the alias for it. To import these packages, type the following commands within the terminal or command prompt:

<strong> python </strong>

<strong> python3 </strong>

To set an alias, type the following commands within the terminal windows:

<strong> python </strong>

<strong> python3 </strong>

How to Upgrade the NumPy Package?

The pip software that has been installed during the installation process (Step 2) can be used for upgrading the NumPy package to the device. The commands that need to execute to do so are as follows:

  • For upgrading NumPy version 2

pip install –upgrade numpy

  • For upgrading NumPy version 3

pip3 install –upgrade numpy


Python makes numerical computations easier with libraries and packages like NumPy. It is an important Python library. The aforementioned steps explain its installation using the pip package manager.

Leave a Comment