How to Install Scipy on Ubuntu

How to Install SciPy on Ubuntu

This article discusses how to install SciPy in Ubuntu OS and what makes this Python library the perfect addition for technical and scientific computing. 

SciPy is a free and open-source library for scientific computing in Python. Its packages include cluster, constants, integrate, io, linalg, signal, sparse, and stats. 

In this article, we will discuss the various steps for installing SciPy. We will start with a brief discussion of SciPy and its multiple features, followed by the installation process. We will then conclude the article with a summary of the steps mentioned for installation.

What is SciPy?

SciPy is a library written in Python that performs a range of scientific programming tasks, such as mathematical computations and algorithms. Underneath, it is based on the NumPy library. Like most of the libraries of Python, it is free and open source. The following are the main features of SciPy:

  • It is used in the domain of engineering, mathematics, and scientific computing
  • It is based on NumPy, a library based on vectorized operations over the arrays
  • It has built-in modules for signal and image processing
  • It also includes modules for integration, optimization, and linear algebra operations

How to install SciPy on Ubuntu

We will discuss the basic steps for the installation of SciPy in Ubuntu. There are various ways to install SciPy in Ubuntu, which include:

  • Using pip, the Python package manager
  • Using the conda tool
  • Using the apt package manager of Ubuntu
  • Using the aptitude package manager

All aforementioned approaches require a simple command line argument to install SciPy. These approaches require Python installation on your computer. Python is a high-level programming language that can be installed in Ubuntu using the following command:

$sudo apt install --no-install-recommends python3-minimal python3  

There are a few fundamental differences in each of these approaches. Each of them differs in their ease of use, coverage, maintenance of old versions, and if their use and control are within a system-wide or local environment. 

The advantage of pip or conda is that you can control the package versions for a specific project. This can prevent a wide range of conflicts. On the other hand, package managers such as apt install SciPy across the whole system. Finally, the installation can be performed via source installation of SciPy, which is a more challenging approach.

Note: The approach of installing SciPy from a source can be a daunting task and is generally not recommended.

Installation using the pip package manager

Before installing the SciPy package using pip, if you want to use a virtual environment, first activate the environment using the following command:

$source .venv/bin/activate

There are several dependencies to be installed with SciPy. This includes NumPy, matplotlib, iPython, juPyter, pandas, symPy, and nose. SciPy and all of these dependencies can be installed by running the following command. Open your Terminal from the system menu and then type the following command:

$pip3 install numpy scipy matplotlib ipython jupyter pandas sympy nose

Alternatively, you can use the following command to install SciPy using pip:

$python -m pip install scipy

It will take a while for the installation of the SciPy package. The next step is to verify the installation. To do this, run the following command on the Terminal:

$python3 -m pip show scipy

The above command will show the details of the SciPy package.

Tip: Before installing SciPy, make sure that you have the latest version of pip by running the following command:

$python -m pip install -U

Installation using conda

Anaconda is a Python distribution packaged with a Python interpreter, different integrated development environments, and a range of Python libraries mostly related to scientific computing. It is an all-in-one distribution best suited for beginners. You can install SciPy using conda with the following command:

$conda install scipy

Installation using the apt package manager

To install the SciPy using the apt package manager, run the following command on your Terminal:

$sudo apt-get install python3-scipy

Tip: Before installing using apt package manager, you may want to update your system by running the following command:

$sudo apt update  

Installation using the aptitude package manager

To install the SciPy using the aptitude package manager, you must install it first. It is an interactive package manager for installation in Linux. Run the following command to install the package manager:

$sudo apt install aptitude

Now, install SciPy as follows:

$sudo aptitude install python3-scipy  

In this article, we have discussed the process for installing SciPy. It is a library for scientific, mathematical, engineering, and statistical computing available for Python. We talked about the features of this library and how it can be installed in Ubuntu. 

There are multiple installation approaches to this, such as pip, anaconda, conda, and apt. Each method has minor differences, like local versus system-wide installation. And all of these differences are highlighted in this article.

If this guide helped you, please share it.

Leave a Reply
Previous Article
How to Use the Fork Bomb on Linux

How to Use the Fork Bomb on Linux

Next Article
How to Install KiCad on Linux Mint 21

How to Install KiCad on Linux Mint 21

Related Posts