Friday, May 12, 2017

setuptools - dealing with compiling custom modules on windows

pip install has hugely simplified how python modules are installed and managed but sometimes it simply can't compile custom extensions despite having all the prerequisites. This simply boils down to pip not being able to automatically determine the required visual studio environment. The simplest fix I found and that I keep forgetting is to get to visual studio command prompt and set a couple of environment variables to prevent distutils from auto discovering the visual studio environment.

%path_to%\vcvarsall.bat x64

SET DISTUTILS_USE_SDK=1
SET MSSdk=1