[Python] Installation Guide of NumPy, SciPy and Matplotlib

Installation and simple examples of NumPy, SciPy and Matplotlib

Download

Installing packages

These are general instructions for installing packages in the SciPy ecosystem.

Scientific Python distributions

For many users, especially on Windows, the easiest way to begin is to download one of these Python distributions, which include all the key packages:

  • Anaconda: A free distribution of Python with scientific packages. Supports Linux, Windows and Mac.
  • Enthought Canopy: The free and commercial versions include the core scientific packages. Supports Linux, Windows and Mac.
  • Python(x,y): A free distribution including scientific packages, based around the Spyder IDE. Windows only.
  • WinPython: A free distribution including scientific packages. Windows only.
  • Pyzo: A free distribution based on Anaconda and the IEP interactive development environment. Supports Linux, Windows and Mac.

Installing via pip

Most major projects upload official packages to the Python Package index. They can be installed on most operating systems using Python’s standard pip package manager.

Note that you need to have Python and pip already installed on your system.

You can install packages via commands such as:


python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose


We recommend using an user install, using the --user flag to pip (note: do not use sudo pip, which can cause problems). This installs packages for your local user, and does not write to the system directories.


Install system-wide via a Linux package manager

Users on Linux can install packages from repositories provided by the distributions. These installations will be system-wide, and may have older package versions than those available using pip.

Ubuntu & Debian

sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
			

Users might also want to add the NeuroDebian repository for extra SciPy packages.

Fedora

Fedora 22 and later:

sudo dnf install numpy scipy python-matplotlib ipython python-pandas sympy python-nose atlas-devel
			

Install system-wide via a Mac package manager

Macs don’t have a preinstalled package manager, but there are a couple of popular package managers you can install.

Macports

For Python 3.5 with Macports execute this command in a terminal:

sudo port install py35-numpy py35-scipy py35-matplotlib py35-ipython +notebook py35-pandas py35-sympy py35-nose
			

Homebrew

You can install NumPy, SciPy, and Matplotlib, with:

brew tap homebrew/science && brew install python numpy scipy matplotlib
			

Other alternatives

Official binary and source packages for most projects are available via pip as explained above.

Binary packages are also available from third parties, such as the Python distributions above. For Windows, Christoph Gohlke provides pre-built Windows installers for many packages.

Source packages

You can build any of the packages from source, for instance if you want to get involved with development. This is easy for packages written entirely in Python, while others like NumPy require compiling C code. Refer to individual projects for more details.

Complete and Continue  
Discussion

0 comments