Python: Unable to find vcvarsall.bat

If you’re running easy_install, pip, zc.buildout, virtualenv, or a similar tool on Windows, and it says:

unable to find vcvarsall.bat

The issue is that you need a compiler installed on your system.  Many people seem to recommend MinGW, but I’ve been there, and it’s a huge pain in the butt.

Just download and install Microsoft Visual Studio Express 2008 which is free. Please note the 2008 part.  This must match the compiler that Python itself was built with, and that’s the 2008 (NOT 2010) version.  (See for more details why 2008 is important.)

25 thoughts on “Python: Unable to find vcvarsall.bat”

  1. Good tips. However, ran into a problem with the pywin32 package install unable to find “mc.exe” even after installing all pieces of VS 2008. Any suggestions for getting mc.exe? Running XP Pro.


  2. Thanks for this shortcut advise. Win32 seems not a good development platform. Solved this problem, the another fatal error stopped the installation. Still cannot connect to mysql.

  3. If you ever get the mc.exe error, please add the following line in the system path under environment variables after installing visual studio 2008.
    C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin
    Your problem will be fixed.

  4. Thank you… I had 2010 installed and was pulling my hair out! Adding the directory of vcvarsall.bat to the %PATH%, thinking about changing code… now I’m just downloading the 2008 .iso

  5. Actually, MinGW is quite easy.
    Just download and install the latest binary package.
    From the command prompt, just do:

    (change the path to your installation path)
    set PATH=C:\MinGW\bin;%PATH%

    to set the environment path, then, let’s say you want to install Crypto, you just need do: build -c mingw32 install

    …is that easy. Sometimes –compiler=mingw32 does the trick too.

  6. I am getting following error when trying to run my code after importing rdfalchemy and installing MS Visual Studio Exprress 2008. Could you please help .
    Traceback (most recent call last):
    File “C:\Python27\”, line 40, in
    import rdfalchemy
    File “build\bdist.win32\egg\rdfalchemy\”, line 2, in
    from rdfalchemy.Literal import Literal
    File “build\bdist.win32\egg\rdfalchemy\”, line 10, in
    from rdflib.Literal import bind as bindLiteral
    ImportError: No module named Literal

  7. Awesome! Been struggling with this problem for a while, and installing vs2008 c++ express edition solved it instantly. I already had VS2011 ultimate beta but didn’t know about the fact the compiler had to match. :)

  8. Installing the MS compiler in correct version is not enought. You have to remember about adding the VC’s bin direcotry to the PATH system variable.

    NOT the location of vcvarsall.bat but, in case of VC++ 2008, it should be (on win7_x64): C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin

    putting the location above at the beginning of %PATH% variable should solve the problem. There is no need to install MinGW.

  9. It’s worth mentioning that this fix will work ONLY on 32-bit python version. I tried using all fixes I’ve found, including this one, on 64-bit and they don’t work.

    My advice: get 32-bit python :)

  10. “Do I really have to download a 900MB file to get one script working?”
    I seem to spend more of my time in open source hunting down dependencies than programming.

Leave a Reply