Install Python Numba in Ubuntu 22.04

Published: January 12, 2023

Last updated: January 12, 2023

Install Python Numba in Ubuntu 22.04

Numba is an open-source just-in-time (JIT) compiler for code written in Python. It integrates with NumPy well. Numba can generate machine code that is faster than the original Python code. For that, it utilizes LLVM Compiler Infrastructure. Numba can get us significant improvement in performance.

With the help of a just-in-time (JIT) compiler, we can compile our code during runtime. For Numba to work, we need to use a Numba decorator to our Python function.

In this article, we cover how to install Python Numba is Ubuntu 22.04 release.

Note: Following operations require administrative rights. If you don't have one then, contact your System Administrator for assistance.

Install Python Numba in Ubuntu 22.04

There are two methods which can be used to install Python Numba in Ubuntu 22.04 release:

  1. through standard Ubuntu repository,
  2. pip3.

Before we proceed, at the time of writing, version number 0.55.1 of Numba is available through standard Ubuntu repository. While, its 0.56.4 when we install the package through PIP3. So, choose the method accordingly.

Method α: The package is available through standard Ubuntu repository. Therefore, first update the repository. We do this to get latest version of packages. Open a terminal and issue the following -

sudo apt update

Next, to install Python Numba -

sudo apt install python3-numba

Method β: Alternately, we can utilize PIP3 to install Python Numba. Issue the following in terminal -

sudo apt install python3-pip

PIP3 is a Python package installer. Ignore the above PIP3 installation command if you already have it.

To install Python Numba through PIP3 -

pip3 install numba

Use any of the following two commands to verify whether Python Numba has installed or not -

pip3 show numba

or,

pip3 list | grep numba

If it returns with text - numba and the installed version number then, its installed.

In conclusion, we covered here two methods which can get us Python Numba in Ubuntu 22.04 release.

Additional Info - 

To remove Numba then issue the following in terminal. If the package was installed through standard Ubuntu repository -

sudo apt remove python3-numba
sudo apt autoremove

If you installed it through PIP3 then, to remove Numba -

pip3 uninstall numba