Install Python, Numpy, SciPy, IPython and Pandas on Windows

In this tutorial we’ll setup a Python development environment on Windows 7. After finishing this tutorial you will be ready to start writing numerical applications, data analysis algorithmns and implement various machine learning methods. I’ve always wanted to get back into numerical computing and Python seems like the way to go.

In this tutorial you will be setting up a numerical Python development environment for Windows 7.

As you might have already realized, Python is rather simple to setup on a Linux/MacOSX box but as with many open source based projects getting up and running on Windows is never trivial.

1) Visit http://www.python.org and search for Python version 3.2.x

2) Double click the Microsoft Installer file from Windows Explorer

  • According to Andrew we have to select the option “Install just for me”

  • Click “Next”

  • Install Python to the root directory of your hard disk mine was “C:\Python32\”

  • On the page “Customize Python 3.2.x” enable the option “Add python.exe to Path”

  • While still on the page “Customize Python 3.2.x” click “Advanced” this will open a new window

  • Check the option on that page; for a discussion for why this option is used see the post on Stackoverflow

http://stackoverflow.com/questions/12376188/should-i-compile-py-files-to-byte-code-after-installation

3) Verify that python installed correctly

  • Press the window key or click the start menu and type “python” and the search results should include

  • “Python (command line)” that is the one we want so click it.

  • You should be able to run a small Hello world program from the python interactive terminal

4) Go install numpy

  • Verify that numpy was successfully installed by opening a command prompt and running the following code

5) Go grab a copy of Visual Studio 2012 if you don’t already have a copy (don’t worry you can use the free express edition)

6) Install the Visual Studio 2012 Isolated Shell the download link is found on the same page

7) Install the Visual Studio 2012 Integrated Shell (same as step 6)

  • NOTICE! At this point if you went the free route and installed Visual Studio Express you will actually have two programs, Visual Studio 2012 in addition to Visual Studio Express
  • To use Python you will have to use Visual Studio 2012

  • To use regular C#, C++, VB etc you will need to run the Visual Studio Express version

8) Install the Python Tools for Visual Studio

  • http://pytools.codeplex.com/

  • Once you have installed the application you should be able to open Visual Studio 2012 and start a new Python application project

9) Within Visual Studio 2012 click Tools >> Options >> Python Tools and change the default version of python to 3.2

  • As you remember from the earlier instructions Numpy currently does not support python 3.3 on Windows

  • If avaliable regenerate the intellisense database, this is what allows Visual Studio to perform autocomplete

  • Next make sure you can get your visual studio 2012 to resemble the screenshots
  • Numpy will show up in the autocomplete if you have been doing everything correctly

10) Setting up Pandas

  • Download and install it

11) Download the dateutil package from http://pypi.python.org/pypi/python-dateutil

  • From within the python-dateutil 2.1 folder copy the folder “dateutil” to “C:\Python32\Lib\site-packages”

  • The “C:\Python32\Lib\site-packages” folder is where 3rd party packages are to be installed

  • You will need this for pandas to work properly

12) Download the package called “six” from pypi http://pypi.python.org/pypi/six/1.2.0

  • Unlike dateutil “six” actually needs to be installed from the command line

  • Extract the zipped folder and then copy the contents to “C:\Python32\Lib\site-packages”

  • Go into the six folder and run the following command

  • “setup.py install”

13) Verify that pandas is working

  • Open Visual Studio 2012 and either start a new Python application or open an existing one

  • Start the Python Interactive shell and enter the code that appears within the screenshot below

14) Install matplotlib for python

15) Verify that matplotlib is running

16) Install SciPy

17) Install IPython

  • http://www.windowsazure.com/en-us/develop/python/tutorials/ipython-notebook

  • Follow the very detailed instructions on that site except the part about the ipython_notebook_config.py file I couldn’t get that part to work.

  • If you get an error relating to missing module JinJa2 then open Powershell and run easy_install.exe Jinja2

  • I managed to get IPython working correctly using the following from Powershell

1
ipython3.exe notebook --pylab=inline --profile=nbserver --certfile='C:\Users\YourNameHere\.ipython\profile_nbserver\mycert.pem'
Share Comments