Installing NumPy with pip fails on Ubuntu

Some of these packages may not be required (don't have time to check in detail) but in a setup script of mine to install the NumPy stack I install the following Ubuntu packages first:

- build-essential
- gfortran
- libatlas-base-dev
- libatlas3gf-base
- python-dev
- libjpeg-dev
- libxml2-dev
- libfreetype6-dev
- libpng-dev

Otherwise you could simply use the Anaconda Python distribution, which works great.


It seems like your system does not have gcc.

Install build tools using following command:

apt-get install build-essential python-dev

pip won't install the necessary compilers for you.

If you simply want numpy, and don't need to go through pip, use

sudo apt-get install python-numpy

For Python 3 packages version:

sudo apt-get install python3-numpy

and you'll get all the requisites as well (such as python-dev).