Binary installers¶
Download Mac OS X 64-bit/32-bit installer; Python 2.7.12 - June 25, 2016. Download Mac OS X 32-bit i386/PPC installer; Download Mac OS X 64-bit/32-bit installer; Python 3.4.4 - Dec. Download Mac OS X 32-bit i386/PPC installer; Download Mac OS X 64-bit/32-bit installer; Python 3.5.1 - Dec. Download Mac OS X 32-bit i386/PPC. Numpy is a very popular library for easily creating single, multidimensional array and matrices. It has a large collection of the mathematical function for performing an operation on these arrays. Most of the new Programmers are unable to install numpy properly.
In most use cases the best way to install NumPy on your system is by using aninstallable binary package for your operating system.
Windows¶
Good solutions for Windows are, Enthought Canopy, Anaconda (which both provide binary installersfor Windows, OS X and Linux) and Python (x, y).Both of these packages include Python, NumPy and many additional packages.
A lightweight alternative is to download the Pythoninstaller from www.python.org and the NumPyinstaller for your Python version from the Sourceforge `download site.
The NumPy installer includes binaries for different CPU's (without SSEinstructions, with SSE2 or with SSE3) and installs the correct oneautomatically. If needed, this can be bypassed from the command line with How to install a52codec.component.
or sse2 or sse3 instead of nosse.
Linux¶
All major distributions provide packages for NumPy. These are usuallyreasonably up-to-date, but sometimes lag behind the most recent NumPy release.
Mac OS X¶
Universal binary installers for NumPy are available from the `download site, and wheel packagesfrom PyPi. With a recent version of `pip``_this will give you a binary install (from the wheel packages) compatible withat python.org Python, Homebrew and MacPorts:
Building from source¶
A general overview of building NumPy from source is given here, with detailedinstructions for specific platforms given seperately.
Prerequisites¶
Building NumPy requires the following software installed:
Python 2.6.x, 2.7.x, 3.2.x or newer
Hqplayer mac hqplayer desktop for mac. On Debian and derivatives (Ubuntu): python, python-dev (or python3-dev)
On Windows: the official python installer atwww.python.org is enough
Make sure that the Python package distutils is installed beforecontinuing. For example, in Debian GNU/Linux, installing python-devalso installs distutils.
Python must also be compiled with the zlib module enabled. This ispractically always the case with pre-packaged Pythons.
Compilers
To build any extension modules for Python, you'll need a C compiler.Various NumPy modules use FORTRAN 77 libraries, so you'll also need aFORTRAN 77 compiler installed.
Note that NumPy is developed mainly using GNU compilers. Compilers fromother vendors such as Intel, Absoft, Sun, NAG, Compaq, Vast, Porland,Lahey, HP, IBM, Microsoft are only supported in the form of communityfeedback, and may not work out of the box. GCC 4.x (and later) compilersare recommended.
Linear Algebra libraries
NumPy does not require any external linear algebra libraries to beinstalled. However, if these are available, NumPy's setup script can detectthem and use them for building. A number of different LAPACK library setupscan be used, including optimized LAPACK libraries such as ATLAS, MKL or theAccelerate/vecLib framework on OS X.
Basic Installation¶
To install NumPy run:
Linux¶
All major distributions provide packages for NumPy. These are usuallyreasonably up-to-date, but sometimes lag behind the most recent NumPy release.
Mac OS X¶
Universal binary installers for NumPy are available from the `download site, and wheel packagesfrom PyPi. With a recent version of `pip``_this will give you a binary install (from the wheel packages) compatible withat python.org Python, Homebrew and MacPorts:
Building from source¶
A general overview of building NumPy from source is given here, with detailedinstructions for specific platforms given seperately.
Prerequisites¶
Building NumPy requires the following software installed:
Python 2.6.x, 2.7.x, 3.2.x or newer
Hqplayer mac hqplayer desktop for mac. On Debian and derivatives (Ubuntu): python, python-dev (or python3-dev)
On Windows: the official python installer atwww.python.org is enough
Make sure that the Python package distutils is installed beforecontinuing. For example, in Debian GNU/Linux, installing python-devalso installs distutils.
Python must also be compiled with the zlib module enabled. This ispractically always the case with pre-packaged Pythons.
Compilers
To build any extension modules for Python, you'll need a C compiler.Various NumPy modules use FORTRAN 77 libraries, so you'll also need aFORTRAN 77 compiler installed.
Note that NumPy is developed mainly using GNU compilers. Compilers fromother vendors such as Intel, Absoft, Sun, NAG, Compaq, Vast, Porland,Lahey, HP, IBM, Microsoft are only supported in the form of communityfeedback, and may not work out of the box. GCC 4.x (and later) compilersare recommended.
Linear Algebra libraries
NumPy does not require any external linear algebra libraries to beinstalled. However, if these are available, NumPy's setup script can detectthem and use them for building. A number of different LAPACK library setupscan be used, including optimized LAPACK libraries such as ATLAS, MKL or theAccelerate/vecLib framework on OS X.
Basic Installation¶
To install NumPy run:
To perform an in-place build that can be run from the source folder run:
The NumPy build system uses distutils and numpy.distutils.setuptools is only used when building via pip or with pythonsetupegg.py. Using virtualenv should work as expected.
Note: for build instructions to do development work on NumPy itself, see:ref:`development-environment`.
Parallel builds¶
Numpy For Machine Learning Pdf
From NumPy 1.10.0 on it's also possible to do a parallel build with:
This will compile numpy on 4 CPUs and install it into the specified prefix.to perform a parallel in-place build, run:
The number of build jobs can also be specified via the environment variableNPY_NUM_BUILD_JOBS.
FORTRAN ABI mismatch¶
The two most popular open source fortran compilers are g77 and gfortran.Unfortunately, they are not ABI compatible, which means that concretely youshould avoid mixing libraries built with one with another. In particular, ifyour blas/lapack/atlas is built with g77, you must use g77 when buildingnumpy and scipy; on the contrary, if your atlas is built with gfortran, youmust build numpy/scipy with gfortran. This applies for most other caseswhere different FORTRAN compilers might have been used.
Choosing the fortran compiler¶
To build with g77:
To build with gfortran:
For more information see:
How to check the ABI of blas/lapack/atlas¶
One relatively simple and reliable way to check for the compiler used to builda library is to use ldd on the library. If libg2c.so is a dependency, thismeans that g77 has been used. If libgfortran.so is a a dependency, gfortranhas been used. If both are dependencies, this means both have been used, whichis almost always a very bad idea.
Disabling ATLAS and other accelerated libraries¶
Numpy Basics For Machine Learning
Usage of ATLAS and other accelerated libraries in Numpy can be disabledvia:
Supplying additional compiler flags¶
Install Numpy For Mac
Additional compiler flags can be supplied by setting the OPT,FOPT (for Fortran), and CC environment variables.
Building with ATLAS support¶
Ubuntu¶
Numpy For Machine Learning Guide
You can install the necessary package for optimized ATLAS with this command: