How To Import Numpy In Python

QR How to Install Numpy

Before we start: This Python tutorial is a part of our series of Python Package tutorials. You can find other Numpy related topics too!

Before you can import numpy, you first need to install it. There are two ways to install numpy: 

  • 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:

'1.15.1'

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
  • Cython 
  • 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.

The following tutorials will provide you with step-by-step instructions on how to work with Pandas, including:

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)

Related Reads:


With deep roots in open source, and as a founding member of the Python Foundation, ActiveState actively contributes to the Python community. We offer the convenience, security and support that your enterprise needs while being compatible with the open source distribution of Python.

Download ActivePython Community Edition to get started or contact us to learn more about using ActivePython in your organization.

You can also start by trying our mini ML runtime for Linux or Windows that includes most of the popular packages for Machine Learning and Data Science, pre-compiled and ready to for use in projects ranging from recommendation engines to dashboards.

Recent Posts

Scroll to Top