new site();

How to get SciPy working in Windows

2017-02-05

For CS7646 I decided to maintain local environments so I could work on the class projects and use IntelliJ. For my Ubuntu machine that was easy, but for my Windows machine I had a hell of a time, with SciPy in particular. It turns out that if you try just using Pip to install it, you can get a bunch of errors, including these:

Everything I read online suggested that to fix this situation I needed to build it from source, which meant installing compilers for C++ and Fortran, Cygwin, MinGW, and other stuff, none of which I actually want on that machine. There are Python distributions that already have SciPy working, but if you already have Python installed and are happy you may not want to mess with those. The answer for my situation wound up being that I had to dump the version of NumPy I was using and get the NumPy-MKL package instead, which contains the libraries mentioned in the above errors thanks to Intel's Math Kernel Library.

So, here are the steps I eventually found to allow me to use SciPy with my existing Python environment without building it from source:

  1. Change to the virtual environment you want to install it to (assuming you're using them; otherwise, forget I said anything until later and then look into it).
  2. Visit http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy and download the NumPy+MKL wheel file that matches your system.
  3. Visit http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy and get the same for SciPy.
  4. Remove NumPy if you've already installed it.
  5. Pip install your downloaded copy of NumPy+MKL.
  6. Pip install your downloaded copy of SciPy.
  7. Verify by opening a python console, importing scipy, then checking to see if scipy.pi outputs pi.