Fred_F
Fred_F

Reputation: 53

Error compiling when installing with pip

I'm having issues when installing packages with pip. I'm running python 3.3 in Pyzo (pre-packaged with numpy, scipy etc) on Windows 8.1 64bit. When i try to install packages with pip that needs compile some c, it fails.

At first I got the error "Unable to find vcvarsall.bat". I looked that up and it seemed like it tried to find the compiler that had been used to build the version of python that I'm running.
error: Unable to find vcvarsall.bat
pip install gives error: Unable to find vcvarsall.bat
Unable to find VCVarsall.bat using Python 2.7
error: Unable to find vcvarsall.bat to compile python modules with Visual Studio 2008 installed

I'm running Visual Studio 2013 for my ordinary .Net stuff but apparently python 3.3 is compiled with Visual Studio 2010. So, i installed Visual C++ 2010 express, but it still gave the same error.

I managed to find the source that is used to look for the vcvarsall (msvc9compiler.py in Lib/distutils). So i started poking around in the source and saw that the version it looked for was 9.0 (i.e Visual 2008). So I downloaded 2008 C++ Express and tried it again. This time it found the vcvarsall.bat but instead I got a different error "ValueError: ['path']" The method that is throwing the error is the following.(The prints are added by me for debugging)

def query_vcvarsall(version, arch="x86"):
"""Launch vcvarsall.bat and read the settings from its environment
"""
vcvarsall = find_vcvarsall(version)
print(version)
print(arch)
print(vcvarsall)
interesting = set(("include", "lib", "libpath", "path"))
result = {}

if vcvarsall is None:
    raise DistutilsPlatformError("Unable to find vcvarsall.bat")
log.debug("Calling 'vcvarsall.bat %s' (version=%s)", arch, version)
popen = subprocess.Popen('"%s" %s & set' % (vcvarsall, arch),
                         stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE)
try:
    stdout, stderr = popen.communicate()
    if popen.wait() != 0:
        raise DistutilsPlatformError(stderr.decode("mbcs"))

    stdout = stdout.decode("mbcs")
    for line in stdout.split("\n"):
        print(line)
        line = Reg.convert_mbcs(line)
        if '=' not in line:
            continue
        line = line.strip()
        key, value = line.split('=', 1)
        key = key.lower()
        if key in interesting:
            if value.endswith(os.pathsep):
                value = value[:-1]
            result[key] = removeDuplicates(value)

finally:
    popen.stdout.close()
    popen.stderr.close()

if len(result) != len(interesting):
    print(str(result)+"::: "+str(interesting))
    raise ValueError(str(list(result.keys())))

return result

So basically, what is happening is that it checks through my environment variables and looks for the entries in interesting ("include", "lib", "libpath", "path") Now, the only one of those that I have is "path", so the final if-statement throws the ValueError. So, what I'm wondering is what are the others, why don't I have them, why is it looking for them and how can I fix it?

Grateful for all answers.

Regards
Fredrik

Upvotes: 3

Views: 4380

Answers (1)

jwalker
jwalker

Reputation: 2009

The problem is that Visual C++ Express 2010 doesn't include 64-bit compiler. See How to compile a 64-bit application using Visual C++ 2010 Express.

Upvotes: 2

Related Questions