Installing SciPy and NumPy on Elementary OS

last updated Jan 12, 2017

There are three main ways to install SciPy and NumPy on Elementary OS and any other Debian-based Linux distribution:

  1. Through apt
  2. From source
  3. With pip

The apt approach is perhaps the simplest option, but it isn’t recommended: depending on what repositories you have selected, you can end up with out-of-date versions of the SciPy and NumPy packages, which can lead to dependency headaches down the line.

Installing from source is a fine idea, but if it’s the right one for you, you probably wouldn’t be reading this article.

The pip approach is the “right” way to do it. On most Linux platforms, there are two versions of pip, one for each version of Python. The version for Python 2.x is contained in the python-pip package; the version for Python 3.x, in the python3-pip package. The former is accessed from the shell with pip, the latter with pip3.

Most SciPy functions require NumPy, but, as of this writing, pip doesn’t take NumPy as a dependency. So for a full install on Python 2.x, you’ll have to run:

sudo pip install scipy numpy

And for Python 3.x:

sudo pip3 install scipy numpy