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 http://mail.python.org/pipermail/python-list/2010-April/1242706.html for more details why 2008 is important.)

Tagged , , , , , , ,

21 thoughts on “Python: Unable to find vcvarsall.bat

  1. Luke Hayens says:

    Thanks a bunch this worked great, I’m glad i come across this site, keep it up.

  2. Brian Welch says:

    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.

    Thanks.

  3. Mark Hyatt says:

    thank you ;)
    you just saved me from pulling my hair out and throwing my pc out the window!

  4. Weiyan says:

    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.

  5. tvks says:

    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.
    :)

  6. Don LD says:

    Sorry, having trouble with your suggestion. First, your link now leads to a vs2010 only page. I did find http://www.microsoft.com/express/Downloads/#2008-Visual-CS which offers a variety. I installed the ‘Visual Basic 2008 Express Edition’, but find no vcvarsall.bat file, and neither does the ‘make’ that I am trying to run. Ideas/suggestion?

  7. JordanRinke says:

    Don, you need to C++ version, at least that one worked for me.

  8. Nathan says:

    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

  9. Piotr Dobrogost says:

    @Nathan

    Did VS 2008 work for you?

  10. [...] - vcvarsall.bat is another story. when building pycrypto it might fire an error that it doesn’t find it, although you can run it from command line anyway (having set the PATH variables correctly). So go fo’ VS2008 bro’. [...]

  11. Marcus says:

    Thanks a lot!

  12. estecb says:

    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:
    setup.py build -c mingw32 install

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

  13. [...] Python: Unable to find vcvarsall.batによると、Visual C++ 2008 Express Edition with SP1をインストールすればエラーがでなくなるらしい。2010では駄目で、2008にするようにと書いてある。リンクから素直に2008をインストールした。 [...]

  14. Muhammad Imran says:

    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 .
    Thanks
    Traceback (most recent call last):
    File “C:\Python27\sesame.py”, line 40, in
    import rdfalchemy
    File “build\bdist.win32\egg\rdfalchemy\__init__.py”, line 2, in
    from rdfalchemy.Literal import Literal
    File “build\bdist.win32\egg\rdfalchemy\Literal.py”, line 10, in
    from rdflib.Literal import bind as bindLiteral
    ImportError: No module named Literal

  15. fmiawenhra says:

    Outdated link: The /express/Downloads link goes to the download page of the most recent version of Microsoft Visual Studio, which is no longer the 2o08 version. The Visual Studio 2008 downloads are available at http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express.

  16. James says:

    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. :)

  17. Zbig says:

    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.

  18. Terry says:

    Thank you :)

  19. sprzet says:

    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 :)

Leave a Reply