Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install gives error: Unable to find vcvarsall.bat

Using pip install zipline on Windows 8 with Python 2.7 gives me the error:

Downloading/unpacking six (from python-dateutil==2.1->delorean->zipline[all])   Running setup.py egg_info for package six  Installing collected packages: blist, pytz, requests, python-dateutil, six   Running setup.py install for blist     building '_blist' extension     error: Unable to find vcvarsall.bat     Complete output from command C:\Python27\python.exe -c "import setuptools;__ file__='c:\\users\\ThatsMe\\appdata\\local\\temp\\pip-build-ThatsMe\\blist\\setup.py';ex ec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" inst all --record c:\users\ThatsMe\appdata\local\temp\pip-xvoky2-record\install-record.tx t --single-version-externally-managed:  running install  running build  running build_py  running build_ext  building '_blist' extension  error: Unable to find vcvarsall.bat 

Question: How can the error be resolved? Running pip install zipline[all] gives the same error...

like image 755
Nyxynyx Avatar asked Nov 07 '13 08:11

Nyxynyx


People also ask

How do I enable a 64 bit Visual C++ toolset on the command line?

To access these command prompts on Windows, on the Start menu, open the folder for your version of Visual Studio, and then choose one of the x64 native or cross-tool developer command prompts.


1 Answers

The problem here is the line 292 (Using Python 3.4.3 here) in $python_install_prefix/Lib/distutils/msvc9compiler.py which says:

VERSION = get_build_version() 

This only checks for the MSVC version that your python was built with. Just replacing this line with your actual Visual Studio version, eg. 12.0 for MSVC2013

VERSION = 12.0 

will fix the issue.

UPDATE: Turns out that there is a good reason why this version is hardcoded. MSVC C runtime is not required to be compatible between major versions. Hence when you use a different VS version you might run into runtime problems. So I advise to use VS 2008 (for Python 2.6 up to 3.2) and VS2010 for (Python 3.3 and later) until this issue is sorted out.

Binary compatibility will arrive with VS 2015 (see here) along with Python 3.5 .

For Python 2.7 users Microsoft released a special Microsoft Visual C++ Compiler for Python 2.7 which can be used without installing the whole VS 2008.

like image 72
ismail Avatar answered Oct 02 '22 13:10

ismail