[Distutils] msvc9compiler.py - vcvarsall.bat is living one folder higher - VS90COMNTOOLS

Dr. Andreas Krueger postings at andreaskrueger.de
Tue Aug 9 18:19:44 EDT 2016


I could not find a github repo, otherwise I would have filed this as an
"issue" there.


The subfolder "VC" is wrong in msvc9compiler.py

- at least on my system (win7-64bit, py2.7.12, anaconda 2.4.1, conda 4.1.11)


So in your "msvc9compiler.py"

instead of            
    productdir = os.path.join(toolsdir, os.pardir, os.pardir, "VC")

it needs to be
    productdir = os.path.join(toolsdir, os.pardir, os.pardir)


Why do I say that?
When googling the error message:  "DistutilsPlatformError: Unable to
find vcvarsall.bat", it is recommended "everywhere" on the web, to
download "VCForPython27.msi", Microsoft Visual C++ Compiler for Python
2.7  http://aka.ms/vcpython27


BUT then

    vcvarsall.bat

ends up being in

    "C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++
for Python\9.0\vcvarsall.bat"

and NOT in

    "C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++
for Python\9.0\VC\vcvarsall.bat"

where YOUR code is expecting it.


Perhaps you actually want to check BOTH places, to keep compatibility
with some older versions / different setups? 
Because I suppose, your code had worked, at some stage in the past.


Thanks a lot!
                           Andreas


P.S.:
I had put some debugging prints to understand your code better, and this
is what it outputs:

toolsdir=
C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++ for
Python\9.0\WinSDK\Bin\
productdir=
C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++ for
Python\9.0\WinSDK\Bin\..\..\VC
productdir=
C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++ for
Python\9.0\VC
vcvarsall=
C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++ for
Python\9.0\VC\vcvarsall.bat

and that last path is wrong.


I could repair it, but only by patching your "msvc9compiler.py":

            productdir = os.path.join(toolsdir, os.pardir, os.pardir,
"VC")    -->
            productdir = os.path.join(toolsdir, os.pardir, os.pardir)

now it does find it:

toolsdir=
C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++ for
Python\9.0\WinSDK\Bin\
productdir=
C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++ for
Python\9.0\WinSDK\Bin\..\..
productdir=
C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++ for
Python\9.0
vcvarsall=
C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++ for
Python\9.0\vcvarsall.bat





More information about the Distutils-SIG mailing list