8

This has been asked and answered a few times, but as you'll see none of the previous answers work for me -- I feel like something had changed to make all the old answers outdated. Or at the very least, I'm in some kind of edge case:

On a Windows 7 box, I've installed MinGW32 and Python 2.7 (32 bit version) (I've also tried this with Python 2.6 and got the same results).

  • Path environment variable is set correctly.

  • I've edited cygwincompiler.py to remove refrences to -mno-cygwin. And I've put the correct distutils.cfg file into C:\Python27\Lib\distutils.

  • To be clear: distutils.cfg contains [build] compiler=mingw32 on two lines.

  • I've also (just to be safe) put pydistutils.cfg in my %HOME% directory. And put setup.cfg in my current directory when running pip. They have same content as distutils.cfg.

I know this is all working because pip install cython and pip install pycrypto both compile successfully.

However, mysteriously, some packages still give me the unable to find vcvarsall.bat error. Two examples are: pyproj and numpy.

It's as if sometimes pip knows to use the MinGW compiler and sometimes it doesn't?

Moreover, if I use the MSYS shell that comes with MinGW then magically pip install numpy succeeds. But pip install pyproj still fails with an unable to find vcvarsall.bat.

I've tried this out on several machines all with the exact same results.

Anybody have any idea what's going on here? Why would pip know to use mingw32 to compile some c modules and not others? Also, why does pip install numpy work inside the MSYS shell but not inside the cmd shell?

BONUS: Many, many older answers suggest installing Visual Studio 2008 as a way of solving a vcvarsall.bat error. But as of this past May, microsoft is no longer distributing this software. Does anyone know of a place where one can still download VS2008? I ask because it's possible that being able to use vcvarsall.bat instead of MinGW would solve this problem.

  • +1 I do have the exact same problem: sometimes pip is able to find mingw, sometimes he cannot. – Sam Jul 10 '13 at 17:14
  • You don't need all of VS2008, you just need the windows SDK, which is still available for download. http://www.microsoft.com/en-us/download/details.aspx?id=3138 (link will probably not age well) – Ian McLaird Nov 14 '13 at 21:25

2 Answers2

1

visual studio express 2008 http://download.microsoft.com/download/8/B/5/8B5804AD-4990-40D0-A6AA-CE894CBBB3DC/VS2008ExpressENUX1397868.iso

Or if you're a student, you can still get Visual Studio 2008 through dreamspark https://www.dreamspark.com/

IMHO I'd recommend using Visual Studio 2008 because the official distributions of Python are all compiled with Visual Studio and is the "official" windows compiler for cpython. http://mail.python.org/pipermail/python-list/2010-April/573606.html

FYI Python 33 is compiled with Visual Studio 2010.

Finally, you could just install packages from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/

sk8asd123
  • 1,665
  • 16
  • 14
0

I've struggled with this issue for a while, and found that sometimes pip seems to ignore MSYS_HOME and can't find pydistutils.cfg, in which case the only recourse seems to be manually copying the pydistutils.cfg into your virtualenv right before running pip install.

It sure would be great if someone could definitively figure out why it sometimes finds this file and sometimes does not. Environment variables seem excessively finicky in MinGW.

Carole
  • 115
  • 2
  • 9