Search code examples
windowsnumpyvirtualenvpipdistutils

My virtualenv pip is not reading the correct distutils.cfg when installing numpy


I am on a Windows 7 machine, using Python 2.7.
I created a virtual environment called "test." Inside test/lib/distutils/distutils.cfg I set:

[build]
compiler = mingw32

Now inside my shell I say:

...\test\Scripts>.\pip install numpy  

Among other things, the output says:

No module named msvccompiler in numpy.distutils; trying from distutils
Running from numpy source  
directory. ...\test\build\numpy\numpy\distutils\system_info.py  

What is happening here?! Is numpy trying to make its own distutils? At the end of it all:

error: Unable to find vcvarsall.bat

----------------------------------------
Command python setup.py egg_info failed with error code 1 in C:\Users\Mark\test\build\numpy  

I understand that the vcvarsall.bat problem is related to a missing Visual Studio compiler. But I had instructed pip to use mingw32, right?


Solution

  • There is a concept called "activation" which I was not aware of. Virtualenv creates a python interpreter for you. In order to use this special interpreter, you have to run the "activate" script inside the scripts directory.