How To Import Numpy In Python
- Install the binary (pre-compiled) version using pip
- Compile it from source code, and then install it
The simplest way to install numpy is to use the pip package manager to download the binary version from the Python Package Index (PyPI.org) and install it on your system using the following command:
pip install numpy
Afterward, you can check if Numpy is properly installed by starting Python and running the following lines of codes.
import numpy as np np.__version__
If everything is properly installed, you should see an output similar to this:
If your company requires that all packages be built from source, you’ll need to manually compile the Numpy library, which means you’ll need to install the following on your local system:
- A C compiler
- A FORTRAN 77 compiler
- A packaging solution for your target OS
Compiling from source can get quite complex, what with environment setup, scripts and patches, not to mention resolving any dependency conflicts or errors that may occur. Instead, consider using the ActivateState Platform to automatically build and package it for you.
Get a version of Python that’s pre-compiled for Data Science
While the open source distribution of Python may be satisfactory for an individual, it doesn’t always meet the support, security, or platform requirements of large organizations.
This is why organizations choose ActivePython for their data science, big data processing and statistical analysis needs.
Pre-bundled with the most important packages Data Scientists need, ActivePython is pre-compiled so you and your team don’t have to waste time configuring the open source distribution. You can focus on what’s important–spending more time building algorithms and predictive models against your big data sources, and less time on system configuration.
Some Popular Python Packages for Data Science/Big Data/Machine Learning You Get Pre-compiled – with ActivePython
- pandas (data analysis)
- NumPy (multi-dimensional arrays)
- SciPy (algorithms to use with numpy)
- HDF5 (store & manipulate data)
- Matplotlib (data visualization)
- Jupyter (research collaboration)
- PyTables (managing HDF5 datasets)
- HDFS (C/C++ wrapper for Hadoop)
- pymongo (MongoDB driver)
- SQLAlchemy (Python SQL Toolkit)