How to Install Numpy, SciPy, Scikit-learn, Pandas, Matplotlib, and NLTK libraries for Python 3 on Windows

NumPy, SciPy, Pandas, and Matplotlib are fundamental scientific computing and visualization packages with Python. Scikit-learn is a simple and efficient package for data mining and analysis in Python. NLTK (the Natural Language Toolkit) is a leading platform for building Python programs to work with human language data. However, if you are using Python on Windows, it seems not easy to install these packages. Thanks to Christoph Gohlke, who provides the non-official Python extension packages for Windows. With these unofficial packages, there is a simple way to install these libraries on Windows.

For clarity, I’m using Python 3.4.3 on 64-bit Windows 7. The steps described below would also work for 32-bit. Please note, after installed Python, I added the ‘Scripts’ directory in Python package where the ‘pip.exe’ and ‘pip3.exe’ located, in my case the path is ‘C:\Python34\Scripts’, to the PATH environment variables. This step makes my life easier, because I don’t need to navigate to the scripts directory anytime I run ‘pip’ or ‘python’.

Install NumPy, SciPy, Pandas, and Matplotlib

The steps of installation of Numpy, SciPy, Pandas, and Matplotlib are the same. Here I take NumPy as an example:

    1. Download appropriate wheel file, in my case, for numpy, it is “numpy-1.10.1+mkl-cp34-none-win_amd64.whl” from the unofficial extension packages site
    2. On the command line, navigate to the directory where you saved the wheel file
    3. Run pip install numpy-1.10.1+mkl-cp34-none-win_amd64.whl
    4. To verify, start python and run
 >>> import numpy  
>>> numpy.__version__

Install Scikit-learn

With a working installation of Numpy and Scipy, it is easy to install scikit-learn through running: pip install -U scikit-learn

Install NLTK

To install NLTK we need to install the Pyyaml package. Follow the steps for installing Numpy above to install Pyyaml first and then NLTK.

References

https://www.codementor.io/numpy/tutorial/installing-numpy-64-bit-windows

http://scikit-learn.org/stable/install.html


Advertisements

4 thoughts on “How to Install Numpy, SciPy, Scikit-learn, Pandas, Matplotlib, and NLTK libraries for Python 3 on Windows

  1. Hello,

    I am following all the instructions coorectly to install nympy and scipy. After changing directly location on commandline – I run pip install numpy-1.11.0+mkl-cp35-cp35m-win_amd64.whl but I receive following error message “SyntaxError: invalid syntax”.

    Pls help me what to do?

    Regards,
    Pramesh

    Like

    • If you really don’t want to try anaconda, please make sure: 1) The python version you installed is the same version of the wheel file, in your case it should also be 3.5; 2) Make sure the directory where the pip.exe file located included in your PATH variables; 3) Make sure there is no space in name of the wheel file when you run the pip install command or put a pair of single quote around the wheel file. The 3 things are what I can image that might cause the invalid syntax error.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s