When I try to build one package:
C:\Linter\intlib\PYTHON>python setup.py build
I get this error message:
running build
running build_ext
building 'LinPy' extension
error: Unable to find vcvarsall.bat
This is my Python version:
Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)] on win32
And I'm working on Windows 10 x64. I know about this thread and dozens of others (like this and this and the list goes on). So, I guess I tried almost everything, but nothing works. It seems like all those threads have become outdated, so I need some new receipt. BTW. I tried this:
SET VS90COMNTOOLS=%VS100COMNTOOLS%
And this (in Visual Studio 2015 Visual Studio Command Prompt):
set DISTUTILS_USE_SDK=1
I looked for vcvarsall.bat
everywhere on my machine, but could not find it.
I investigated this folder C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools
, but it does not contain any .bat
files. Anyway, after all my manipulations python setup.py build
still raises the very same error. So, I need help. Thanks!
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.
Updated solution for Python 3.9.X with latest SDK and build tools:
Step 1: Install and run build tools for VS 2019 https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019
Step 2: Select Windows 10 SK (10.0.20348.0+) and MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.29-16.10+) from individual components section and and click Install
Step 3: Proceed to build your python application with vcvarsall.bat now being present.
Note: vcvarsall.bat can be found in C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build
Step 1: Install Visual C++ 2010 Express from here.
(Do not install Microsoft Visual Studio 2010 Service Pack 1 )
Step 2: Remove all the Microsoft Visual C++ 2010 Redistributable packages from Control Panel\Programs and Features. If you don't do those then the install is going to fail with an obscure "Fatal error during installation" error.
Step 3: Install offline version of Windows SDK for Visual Studio 2010 (v7.1) from here. This is required for 64bit extensions. Windows has builtin mounting for ISOs like Pismo.
Step 4: You need to install the ISO file with Pismo File Mount Audit Package. Download Pismo from here
Step 5: Right click the downloaded ISO file and choose mount with Pismo. Thereafter, install the Setup\SDKSetup.exe instead of setup.exe.
Step 6a: Create a vcvars64.bat file in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64 by changing directory to C:\Program Files (x86)\Microsoft Visual Studio version\VC\ on the command prompt.
Type command on the command prompt:
cd C:\Program Files (x86)\Microsoft Visual Studio version\VC\r
Step 6b:
To configure this Command Prompt window for 64-bit command-line builds that target x86 platforms, at the command prompt, enter:
vcvarsall x86</p>
I did a search for a python wheel of LinPy
unfortunately there happened to be none.
Cython
has a very good workaround for setting up a windows C/C++ compiler for builds in python. You can find it here. Since you've already downloaded the SDK/.NET framework, you should go ahead and install it as it will be needed as part of the steps. If your system reports there is already an existing version, you may uninstall, restart and reinstall.
A hackish alternative is to search for vcvars32.bat
or vcvarsall.bat
(these batch files are only to set up environment variables for compile time) in your Visual studio installation directory. If you don't find any, then you should install the SDK. I managed to do a work around by hardcoding the path to vcvars32.bat
or vcvarsall.bat
in the find_vcvarsall
function of C:\Python34\Lib\distutils\msvc9compiler.py
, but there is a missing library (ISL - Integer Set Library). I think it's because I am using VC11.
I don't have the SDK, but you may try these and see what happens from your end
You can ease your pains with Microsoft compilers for Python 3.4 by installing mingwpy or libpython (not both):
pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy
conda install libpython
The issue is caused because you don't have a compiler installed for the receptive build you are trying to run.
The following is what you may require as per the MS Python Engineering community,
Python Version |You will need
------------------------------------
3.5 and later |Visual C++ Build Tools 2015 or Visual Studio 2015
3.3 and 3.4 |Windows SDK for Windows 7 and .NET 4.0
|(Alternatively, Visual Studio 2010 if you have access to it)
2.6 to 3.2 |Microsoft Visual C++ Compiler for Python 2.7
You will need to install: Windows SDK for Windows 7 and .NET 4.0 or VS 2010
Source: How to deal with the pain of “unable to find vcvarsall.bat”
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With