Monday, March 9, 2015

Python - Unable to find vcvarsall.bat

Problem:
Working on a quick prototype using maxmind, I wanted to use my new python skills. The geoip2 module looked like a good place to start, but I had to install the maxminddb module first. Trying to install that using pip gave me the following error:

UserWarning: Unknown distribution option: "bugtrack_url"
...
error: Unable to find vcvarsall.bat


Solution:
Looking online I found a couple SO questions that were exactly the same as mine. "How to I set vcvarsall.bat?" Turns out this is because when python builds the extension is wants to build it for Windows using the same C Runtime libraries python itself was built with. Several people indicated that the solution here was to install Visual C++ 2008 Express Edition (but seeing as it is now 2014, this was somewhat difficult to find).

To install these C Runtime libraries, download Visual C++ 2008 Express Edition.

Once you have it installed, you will need to restart your machine (or do something to allow the new environment variable of VS90COMNTOOLS to take).

Now you should be able to install your new extension using pip.

No comments: