error: Unable to find vcvarsall.bat
failed-installation, pip, python, setup.py, windows
Solution
Update: Comments point out that the instructions here may be dangerous. Consider using the Visual C++ 2008 Express edition or the purpose-built Microsoft Visual C++ Compiler for Python (details) and NOT using the original answer below. Original error message means the required version of Visual C++ is not installed.
For Windows installations:
While running setup.py for package installations, Python 2.7 searches for an installed Visual Studio 2008. You can trick Python to use a newer Visual Studio by setting the correct path in `VS90COMNTOOLS` environment variable before calling `setup.py`.
Execute the following command based on the version of Visual Studio installed:
- Visual Studio 2010 (VS10): `SET VS90COMNTOOLS=%VS100COMNTOOLS%`
- Visual Studio 2012 (VS11): `SET VS90COMNTOOLS=%VS110COMNTOOLS%`
- Visual Studio 2013 (VS12): `SET VS90COMNTOOLS=%VS120COMNTOOLS%`
- Visual Studio 2015 (VS14): `SET VS90COMNTOOLS=%VS140COMNTOOLS%`
WARNING: As noted below, this answer is unlikely to work if you are trying to compile python modules.
See Building lxml for Python 2.7 on Windows for details.
Problem
I tried to install the Python package dulwich: ``` pip install dulwich ``` But I get a cryptic error message: ``` error: Unable to find vcvarsall.bat ``` The same happens if I try installing the package manually: ``` > python setup.py install running build_ext building 'dulwich._objects' extension error: Unable to find vcvarsall.bat ```
Related problems
- Compiling with cython and mingw produces gcc: error: unrecognized command line option '-mno-cygwin'
- Does Python have a package/module management system?
- What version of Visual Studio is Python on my computer compiled with?
- Building lxml for Python 2.7 on Windows
- Value error trying to install Python for Windows extensions
- Visual C++ 2008 Express Download Link Dead?
- Compiler problems with pip during numpy install under Windows 8.1, 7 Enterprise and 7 Home Editions
- Errors while building/installing C module for Python 2.7