pythonpython-2.7numpypython-install

Numpy backwards compatibility: Visual C++ 9 not found


I downloaded numpy-1.10.1 from sourceforge and I have Python 2.7. I extracted, renamed and entered the numpy directory under site-packages. I ran the

python setup.py install

command, and got this error message. I have Microsoft Visual C++ 2013 Redistributable, and it's asking for version 9.

C:\Python27\Lib\site-packages\numpy
$ python setup.py install

[lots of text]
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat) Get it from http://aka.ms/vcpython27

Why isn't it backward compatible?


Solution

  • Python 2.7 uses Visual Studio 9, which came out in 2008. When you're building Python extensions, you must use the same compiler that the package was built with. So unfortunately, you'll have to download it if you want to build it yourself. You may be able to use the Microsoft Visual C++ Compiler for Python 2.7, but I haven't tested it with numpy.

    On the other hand, if you don't want to download a new compiler (You can't even find Visual Studio 9 via Microsoft's website anymore), you can download a pre-built wheel from Christoph Gohlke's website. If you don't have a good reason to build it yourself, I recommend doing that. You can download the numpy wheel, and then pip install "C:\path\to\numpy‑1.9.3+mkl‑cp27‑none‑win_amd64.whl".

    There are ways to build the extensions with some version of MinGW somewhere, but I'm not sure how to do it. Christoph Gohlke's extensions work nicely though, and I would recommend just downloading those.