I am unable to install numpy via pip install numpy on my computer running Python 3.4 due to various errors I receive linked to compilation issues (This is only the case on a
Although the accepted answer is working, it's an unnecessary monkey-patch to a battle-tested library.
To fix the issue at it's core: Simply add (x86 or x64 - depending on your target) Microsoft Manifest Tool (mt.exe) to your path and install numpy through pip.
Since Visual Studio 2017, mt.exe has moved to the Windows SDK 7.1/8.1/10, which needs to be installed.
My mt.exe (x86) is located in: C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x86
so that's what I have added to the path, do that ether through Control Panel > System > Advanced system settings > Environment Variables or by using the pathman command in the console (cmd.exe).
Hope it helps, happy compiling!
If you didn't fixed the issue with those steps please check this simple solution that helped me to build numpy: Go to Jurko's repository * in which he is patching/improving the scripts for building with MSVC and download/copy paste the files:
msvc9compiler.py
msvccompiler.py
Links:
https://bitbucket.org/jurko/cpython/src/b0962aec201e7d4b4f1ac32dbc130379ec6d943a/Lib/distutils/msvc9compiler.py?at=jurko/distutils_msvc_express_fix
https://bitbucket.org/jurko/cpython/src/b0962aec201e7d4b4f1ac32dbc130379ec6d943a/Lib/distutils/msvccompiler.py?at=jurko/distutils_msvc_express_fix
Save them in the folder '\Lib\distutils\' of your python installation directory, eg: "C:\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\Lib\distutils".
There are several other solutions related to this issue of building python modules with pip/easy_install, eg: error: Unable to find vcvarsall.bat ; Unable to find vcvarsall.bat using Python 3.3 in Windows 8 that seem unsolvable sometimes.
My system: windows 7, windows sdk 7.1, vs2010 express with sp1, python 3.4.3, 64 bit
I was able to reproduce all these errors in Windows 7 Professional (64 bit).
Your final issue (Broken toolchain) is caused by more manifest related issues. I was able to work around this by changing the following line (in msvc9compiler.py):
mfinfo = self.manifest_get_embed_info(target_desc, ld_args)
to
mfinfo = None
thus bypassing the if statement which immediately follows. After this change numpy successfully compiled for me.
I think the easiest solution will be to open the Visual Studio command prompt (you should not need any other fixes, just the latest version of Python 2 or 3).
Specifically, in your Start menu, you should have something like "Visual Studio Command Prompt (2010)". Open this program (it will open a command prompt), then in the command prompt, type:
pip install numpy
Comments:
1) Different versions of Python are meant to be compiled with different versions of Visual Studio. I think that the Python guys intend for you to compile with the 2010 version (I could be wrong about this), so trying to open the Visual Studio 2013 prompt might not work. It could be that the newest version of Python switched compilers, but I would start by trying the 2010 command prompt.
2) You might have multiple command prompt options. I have had luck with just the bare bones version "Visual Studio Command Prompt (2010)"
3) To install Python 3.4, I could simply open a standard command prompt, and then
pip install numpy
but for Python 2.7, I had to use this command prompt trick.