UPDATE 1: I’ve discovered via my own research that this post contains some inaccuracies regarding the limitations of Python on Windows. I’ll do a follow up post correcting this as soon as I successfully set it up on my machine.
UPDATE 2: Please read follow up post here for a more accurate assessment of the Python on Windows experience.
Note: if something here is wrong or inaccurate, please point it out to me in the comments. My main problem with setting up Python is not the steps involved, but that the steps are undocumented and non-obvious. I only succeeded in setting up Python for the project I was working on because a colleague had the necessary installers on hand. This was after several rounds of installing and uninstalling.
Congratulations! After hearing about the wonderful world of the Python language, you’ve decided to join the hordes of technical developers who are plunging headlong into it! Now to set it up on your Windows workstation and get t- Uh oh, why is nothing working?
Truth is, you’ve been deceived. Not much about Python is (necessarily any more) straightforward (than any other language). Python’s main advantage is that line breaks and delimiting are actually part of the syntax, which forces readable code by default. The impact of this depends on the coding standards – if they exist at all – where you work. The main disadvantage of Python (on Windows) is just how bad the UX is. A Google search for instructions is likely to turn up stuff for Windows XP. In 2013. I’m not kidding.
So let’s get started, shall we? The first thing to determine which version of Python to use. That should be simple: the latest, right? Nope. A dirty secret of Python is there are some pretty significant incompatibilities among versions. While the project acknowledges the clean break between versions 3.* and 2.*, there are multiple poorly documented quirks within both of those version families. Quirks which, unfortunately, have largely been left to hapless engineers to discover on their own. I have binaries on my end that work just fine with Python 2.4.* but fail to execute on 2.7.*
Another perhaps even dirtier Python secret is that only 1 version of Python can exist on your machine at any time. This means that you’re stuck with whichever version you pick unless you uninstall it and install a different build. You can run multiple versions of Python on the same machine, but only 1 of those can be added to your Windows environment variables.
You decide which version to use by determining whether you’re starting a brand new standalone project or using someone else’s code. If you’re doing the former, start with the latest version of Python (this guide is deliberately version-agnostic to keep it as current as possible without editing) that is supported by both NumPy and SciPy. You can find this out by visiting the NumPy and SciPy download pages. Drill down into the folders there and look for the highest number common to both packages following “-python” in the .exe files there. Once you’ve done that, download both files but DO NOT INSTALL THEM YET.
If you’re using someone else’s code or compiled executable, find out which version of Python it was built in, and use that. Remember to find the corresponding SciPy and NumPy versions as above, but searching for -pythonA.B.exe instead, where A.B is the version the code you have was written in. An alternative to the second case is to simply go by trial and error and find the latest version that works, but that’s likely to result in you committing suicide, which this post is intended to prevent in the first place. In any case, download both SciPy and NumPy packages but do not install them until after you have installed Python.
Once you’ve determined the Python version number you want to use, head over to the Python download page and select the closest matching release. Unfortunately, the UX here is awful too. If you need Python 2.4 for Windows, for example, and click on the link for 2.4.6 in the page above, you land here, where you’re informed that Windows users must select between 2.4.4 and 2.6.1. Because this process totally makes sense /s, neither of those versions is listed on the releases page above.
For some versions, you’ll have to select between 32-bit and 64-bit Python. Select the 32-bit version as SciPy doesn’t (officially) support the 64-bit builds. In 2013. Download and install it as you would any other Windows installer.
Once that’s done, install SciPy and NumPy.
With that, you should be good to go. The process isn’t that hard if you know what to do, but of course the devil is in the latter part: the documentation is so poor it’s difficult to determine that.