Some explanation
In the first case, I did not check, but I think pip directly loads the resource corresponding to the given URL: http://sourceforge.net/projects/numpy/file/NumPy/ . The server returns an HTML document, and pip expects an archived one. So this will not work.
Then there are two ways to install Python packages:
- from sources as you tried
- from precompiled packages
In the first case, you tried it with the pip install numpy command, but since this package contains its own code, it requires the development tools to be installed correctly (which I always thought was a pain in the neck to do on Windows, but I made it so that it it was clear). You have the error error: Unable to find vcvarsall.bat means that you do not have installed tools or an environment that is configured properly.
In the second case, you have different types of precompiled packages:
- which you install using
pip as well - which you use as standard installers in Windows
For both, you need to verify that the binary has been strictly compiled for your Python architecture (32 or 64 bits) and version.
Easy solution
You can find several wheels for numpy : http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy . To get the correct architecture, check the name win32 for 32 bits and amd64 for 64 bits. To get the correct version of Python, check cpXX : the first X is the major version, and the second X is the minor version, so, for example, cp27 means CPython 2.7.
Example: pip install numpy‑1.9.2rc1+mkl‑cp27‑none‑win32.whl
Hard decision: installing and using development tools
DISCLAIMER : All of the following explanations may not be entirely clear. They were the result of several studies at different points, but in my configuration they led to a working solution. Some links may be useless or redundant, but this is what I noted. All this requires a little cleaning and, possibly, generalization too.
First, you need to understand that disutils - this is a pre-installed package that processes the package workflow at a lower level than pip (and which is used by the latter) - will try to use a compiler that strictly matches the one that was used to create The Python machine you installed.
Official Python distributions use Microsoft Visual C ++ for Microsoft Windows packages. Therefore, you will need to install this compiler in this case.
How to find the correct version of Visual C ++
A line printed by Python with this python -c "import sys; print(sys.version)" command python -c "import sys; print(sys.version)" (or when invoking the interactive shell) will look like this:
3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)]
The last part between the square brackets is the compiler identification part. Unfortunately, this is not entirely clear, and you have correspondence lists:
In the above example, this means 64 bits of Microsoft Visual C ++ 2010.
How to install Visual C ++
You cannot find the standalone Visual C ++ package for modern versions. Therefore, you will need to install the Windows SDK itself.
Here are some links:
Troubleshooting
You may have an error installing SDK: DDSet_Error: Patch Hooks: Missing required property 'ProductFamily': Setup cannot continue. DDSet_Warning: Setup failed while calling 'getDLLName'. System error: Cannot create a file when that file already exists. DDSet_Error: Patch Hooks: Missing required property 'ProductFamily': Setup cannot continue. DDSet_Warning: Setup failed while calling 'getDLLName'. System error: Cannot create a file when that file already exists.
This has been reported on several issues:
As a solution, you can check this link: Windows SDK could not be installed with return code 5100
The point is to remove all conflicting ones (understand: those that the SDK installer is trying to install on their own), the version distributed in Visual C ++.
Use development tools
Normally, you should run vsvarsall.bat (located inside the VC folder of the Visual Studio installation path - example: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat ) to configure the correct environment variables so that distutils do not failed when trying to compile a package.
This batch script takes a parameter that should set the required architecture. However, I saw that with the free versions of the SDK, some additional scripts were missing when trying to execute several of these parameters.
Just to say that if you are compiling a 32-bit architecture, you just need to call vsvarsall.bat . If you need to compile 64 bits, you can directly call SetEnv.cmd , located somewhere inside the SDK installation path, for example: "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 .