Does `pip install` respect the compiler version used to build Python? - python

Does pip install always build extension modules with the same compiler that was used to compile the current Python version?
For example, this blog post explained that numpy package uses C code, which has to be compiled against the same compiler as the Python itself:
Python 2.7.13 (default, Aug 21 2017, 11:46:40) [MSC v.1900 64 bit (AMD64)] on win32
tells us which compiler was used. numpy and other packages have to be compiled against that identical version.

pip install never installs a compiler. You have to have the compiler before running pip install.
See https://wiki.python.org/moin/WindowsCompilers to learn what version of VC you need to install for different versions of Python.
It would be much simpler to install a precompiled wheel. Said numpy has a lot of precompiled wheels. Currently there are binary wheels for Python 2.7, 3.5, 3.6 and 3.7 on MacOS 64 bits, Linux 32 and 64 bits, Windows 32 and 64 bits. Just type pip install numpy and your pip automatically determines what platform it's being ran on and download and install the proper wheel.

Yes! Originally pip was built on top of distutils package which by default enforces extension modules to be compiled with the same compiler as an interpreter itself. Currently it mostly installs packages from pre-built wheels (which in turn are also built with help of distutils) and packages still have to use setuptools to be able to build extension modules.
On Windows com­piler ver­sion is also enforced to be the same (or, since Python 3.5, compatible). On Unix-likes the compiler and linker flags used to compile Python will also be used to compile extensions.
Note that this is more of a convenience and safeguard rather than a requirement. Except for some special cases Python exten­sions should work just fine when built with another compiler version.

Pip prioritises the version on your PATH. Pip3 and Pip are used to differentiate between the two versions.
https://docs.python.org/2/installing/index.html

Related

pip install error: Microsoft Visual C++ 10.0 is required

I have Python 3.4, running on Windows 10 x64, trying to install pylint via pip: pip install pylint.
When doing so, I get the following error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279
However I already have:
Microsoft Visual C++ 2010 x64, Microsoft Visual C++ x86 both Redistributable
Microsoft Visual C++ 2013 x64, Microsoft Visual C++ x86 both Redistributable
Microsoft Visual C++ 2015 - 2019 x64, Redistributable
Microsoft Visual C++ 2017 x64, Microsoft Visual C++ 2017 x86 both Redistributable
I saw some other posts with possible solutions that I've tried and did not seem to help to me -
updating setuptools and virtualenv
Downloading the SDK given in the error
Add VS110COMNTOOLS, VS120COMNTOOLS, VS140COMNTOOLS env variables
Of course, after every attempt I've rebooted my PC.
What else could I try to fix this?
Is it possible to install pylint without pip?
You don't have any Visual C++, you only have Redistributable packages. They install run-time libraries that are used to run applications written with VC. But you need Visual C++ compiler! Install Visual Studio 2010 Express.
See also https://stackoverflow.com/search?q=%5Bpip%5D+%22Microsoft+Visual+C%2B%2B+10.0+is+required%22
Python 3.4
According to [Python]: PEP 429 -- Python 3.4 Release Schedule (emphasis is mine):
Python 3.4 has now reached its end-of-life and has been retired. No more releases will be made.
The last version (3.4.10) was released on 2019/03/18.
So, you should move away from it (I'd recommend the (current) LTS version: 3.7). That doesn't magically solve all possible problems, but being a newer version, it requires newer build tools (VStudio) which are easier to find, and have a higher probability of installing and running correctly.
Notes:
Even if you manage to solve the problem for this version, you'll be likely to run into it again when trying to install other such packages, as more and more of them will no longer support it
Python 3.5+ are built with VStudio 14.X. Starting with VStudio 2015 (14.0), MS did some changes to improve backward and forward compatibility between VStudio versions. More details on [SO]: How to circumvent Windows Universal CRT headers dependency on vcruntime.h - (#CristiFati's answer)
2. Pylint
[PyPI]: Pylint is written entirely in Python (I checked the source code), so it wouldn't require a C(++) compiler. This is also backed up by the existence of the pylint-2.3.1-py3-none-any.whl file (available for download).
Some of its dependencies (wrapt, typed-ast: which don't have prebuilt binaries for Python 3.4 on Win - makes sense considering the previous bullet) require it.
According to [PyPA]: pip install - Options (pip install -h):
--no-deps
    Don’t install package dependencies.
Now, I don't know your Pylint usecase: whether you are using the parts of it that require the above dependencies, but if you don't, simply pass the --no-deps argument.
[cfati#CFATI-5510-0:e:\Work\Dev\StackOverflow\q057581571]> sopr.bat
*** Set shorter prompt to better fit when pasted in StackOverflow (or other) pages ***
[prompt]> "e:\Work\Dev\VEnvs\py_064_03.04.04_test0\Scripts\python.exe" -c "import sys;print(sys.version)"
3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)]
[prompt]> "e:\Work\Dev\VEnvs\py_064_03.04.04_test0\Scripts\python.exe" -m pip freeze
[prompt]> "e:\Work\Dev\VEnvs\py_064_03.04.04_test0\Scripts\python.exe" -m pip install --no-deps pylint
Collecting pylint
Using cached https://files.pythonhosted.org/packages/60/c2/b3f73f4ac008bef6e75bca4992f3963b3f85942e0277237721ef1c151f0d/pylint-2.3.1-py3-none-any.whl
Installing collected packages: pylint
Successfully installed pylint-2.3.1
You are using pip version 18.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
[prompt]> "e:\Work\Dev\VEnvs\py_064_03.04.04_test0\Scripts\python.exe" -m pip freeze
pylint==2.3.1
[prompt]>
[prompt]> :: Pylint dummy usage example - just import it
[prompt]> "e:\Work\Dev\VEnvs\py_064_03.04.04_test0\Scripts\python.exe" -c "import pylint;print(pylint)"
<module 'pylint' from 'e:\\Work\\Dev\\VEnvs\\py_064_03.04.04_test0\\lib\\site-packages\\pylint\\__init__.py'>
As seen, the package was installed, and it's usable.
Notes:
There are (official) prebuilt Python 3.5 (and newer) binaries for typed-ast, but not for wrapt, so a Python upgrade will still require building it (assuming that it's needed)
You could always turn to unofficial prebuilt binaries. [UCI.LFD]: Unofficial Windows Binaries for Python Extension Packages is the most comprehensive repository (that I know of), and contains the wrapt build for Python 3.4 (but doesn't the typed-ast one :) )
3. Or else ...
Python 3.4 version is built (on Win) using VStudio 2010 (10.0). Since it's written in C, it requires a C compiler. More details on [Python.Wiki]: WindowsCompilers.
Every package that contains parts written in C(++) (and needs to be built from sources at pip install time - meaning that there are no prebuilt binaries on the public repository), also requires the compiler (the compiler version must match the one that Python was built with).
The above URL lists the 4 items that need to be installed in order to get things going:
Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1
Microsoft Windows SDK for Windows 7 and .NET Framework 4
The other 2 are dependencies for these 2 (and I tend to think that will be automatically installed)
I didn't (have to) attempt this step, as I already have VStudio 2010 installed. As a side note, I have 7 VStudio versions (with their corresponding SDKs) installed, and also I have 30+ Python instances (installed, VEnvs, custom built by me, installed by other 3rd-party software, ...) on my machine.
Once you get the (above) build tools installed (and the %VS*% env vars pointing to the desired VStudio version - you have to do this manually when having multiple versions), you will be able to install most of the Python packages containing C(++) code. But there will probably be a few exceptions. Here's an example that gave me some headaches: [SO]: Installing pygraphviz on Windows 10 64-bit, Python 3.6 - (#CristiFati's answer) (check it out - and the URLs it references, there's a bunch of useful information there).
I noticed that you're having some problems installing VStudio 2010. With the risk of repeating myself, switching to a newer Python version would make some of your current problems go away, since it would require newer build tools which are less likely to fail installing. Everything else still applies, though.
Update #0
Concerning the last inquiry in the question:
It's possible to install Pylint without pip, for example doing (almost) what pip does, but manually. However, from what am I concerned, this would be a (lame) workaround (gainarie). Anyway, here are the steps:
Download and unpack the .whl (from section #2.)
Copy the (inside) pylint dir, under Python's site-packages dir
But again, everything done here is also done properly in #2., so this is truly pointless.
Maybe you can try to install pylint from https://www.lfd.uci.edu/~gohlke/pythonlibs/
You could try installing Visual Studio Code and opening your project from there. From my experience, Visual Studio Code offers to install pylint (and other missing libraries) for you when it recognizes it's missing.

Trouble installing and importing pyHook

This is my first question on this site so I hope I format this correctly. I also am very new to programming so bear with my lack of knowledge, thank you!
I'm trying to install pyHook like so and I keep getting this error message:
C:\Python27>py -2.7 -m pip install pyHook-1.5.1-cp27-cp27M-win_amd64.whl
pyHook-1.5.1-cp27-cp27M-win_amd64.whl is not a supported wheel on this platform.
I have python 2.7.14 as you can see from below:
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit
(AMD64)] on win32
Just in case, I tried updating pip and It said it was up to date. I also tried install this version of the .whl and I get the same error:
C:\Python27>py -2.7 -m pip install pyHook-1.5.1-cp27-cp27m-win32.whl
pyHook-1.5.1-cp27-cp27m-win32.whl is not a supported wheel on this platform.
From reading online I believe cp27 indicates its for python 2.7 and to be safe I tried the 64 bit and 32 bit files, but nothing seems to work. If anyone could offer up any solutions or advice, it would be greatly appreciated!
I installed Python 2.7, then pyHook and was able to get it working following these exact steps.
Note, I was using Anaconda to create the Python 2.7 environment and Windows 10 is my OS.
conda create -n python27 python=2.7 This created a new conda environment with python 2.7.14.
activate python27
python -m pip install --upgrade pip This installed pip version 10.0.0
Downloaded pyHook from the unofficial windows binaries.
Specifically: pyHook-1.5.1-cp27-cp27m-win_amd64.whl
Navigated to downloads folder in command prompt
pip install pyHook-1.5.1-cp27-cp27m-win_amd64.whl
That installed it properly with no error messages. Hope that helps. My guess is that the new pip version fixes it, or there is a problem with how you are installing Python 2.7, so try Anaconda (or miniconda if you want to keep it light)
I was also able to import it with no problem after these steps.
Many binaries depend on numpy-1.13+mkl and the Microsoft Visual C++ 2008 (x64, x86, and SP1 for CPython 2.7), Visual C++ 2010 (x64, x86, for CPython 3.4), or the Visual C++ 2017 (x64 or x86 for CPython 3.5, 3.6, and 3.7) redistributable packages.
Install numpy+mkl before other packages that depend on it.
I have Microsoft Visual C++ 2008.I just do this,
python -m pip install numpy-1.13.3+mkl-cp27-cp27m-win_amd64.whl
python -m pip install pyHook-1.5.1-cp27-cp27m-win_amd64.whl
then it work.

Installing NumPy on Windows

I'm simply unable to install NumPy on Windows. I keep getting this error -
PS C:\python27> pip install http://sourceforge.net/projects/numpy/file/NumPy/
Collecting http://sourceforge.net/projects/numpy/files/NumPy/
Downloading http://sourceforge.net/projects/numpy/files/NumPy/ (58kB)
100% |################################| 61kB 15kB/s
Cannot unpack file c:\users\toshiba\appdata\local\temp\pip-qev4rz-unpack\NumPy
(downloaded from c:\users\toshiba\appdata\local\temp\pip-omripn-build, content-type: text/html; charset=utf-8); cannot detect archive format
Cannot determine archive format of c:\users\toshiba\appdata\local\temp\pip-omripn-build
I had a Python 64 bit version earlier and I was not sure if NumPy version was compatible with 64-bit Python. So I uninstalled it and installed a 32-bit Python version. But still I'm getting the same error. Though my Python 32-bit version is working fine.
I tried "pip install numpy", but that gave me the following error at the end -
C:\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
error: Unable to find vcvarsall.bat
----------------------------------------
Command "C:\Python27\python.exe -c "import setuptools,tokenize;__file__='c:\\users\\toshiba\\appdata\\local\\temp\\pip-build-hdhqex\\numpy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'),__file__, 'exec'))" install --record c:\users\toshiba\appdata\local\temp\pip-x_6llm-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\toshiba\appdata\local\temp\pip-build-hdhqex\numpy
What might I be doing wrong?
Some explanations
In the first case, I didn't check but I guess that pip directly downloads the resource corresponding to the given URL: http://sourceforge.net/projects/numpy/file/NumPy/. The server returns a HTML document, while pip expects an archive one. So that can't work.
Then there are basically two ways to install Python packages:
from sources, as you tried then
from pre-compiled packages
The first case, you tried it with the command pip install numpy, but since this package contains native code, it requires development tools to be installed properly (which I always found to be a pain in the neck to do on Windows, but I did it so it's clearly feasible). The error you have error: Unable to find vcvarsall.bat means you don't have the tools installed, or the environment properly set up.
For the second case, you have different kinds of pre-compiled packages:
wheels, which you install with pip as well
installers, which you use as standard installers on Windows
For both, you need to check that the binary has been strictly compiled for your Python architecture (32 or 64 bits) and version.
An easy solution
You can find there several wheels for numpy: http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy. To get the proper architecture, check in the name win32 for 32 bits and amd64 for 64 bits. To get the proper Python version, check cpXX: first X is major version, and second X is minor version, so for instance cp27 means CPython 2.7.
Example: pip install numpy‑1.9.2rc1+mkl‑cp27‑none‑win32.whl
The hard solution: installing and using development tools
DISCLAIMER: all the following explanations might not be quite clear. They result from several investigations at different moments, but in my configuration they led to a working solution. Some links might be useless, or redundant, but that's what I noted. All of this requires a bit of cleaning, and probably generalization too.
First, you need to understand that disutils - which is the pre-installed package which handles packages workflow at 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 build the Python machine you installed.
Official distributions of Python use Microsoft Visual C++ for Microsoft Windows packages. So you will need to install this compiler in this case.
How to find proper version of Visual C++
The string printed by Python with this command python -c "import sys; print(sys.version)" (or when you invoke 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 square brackets is the identification part of the compiler. Unfortunately, this is not quite straightforward, and you have correspondence lists there:
windows - What version of Visual Studio is Python on my computer compiled with? - Stack Overflow
visual studio - Detecting compiler versions during compile time - Stack Overflow3
Pre-defined Compiler Macros / Wiki / Compilers
WinCvt - Windows Converter toolkit
In the example I gave above, this means Microsoft Visual C++ 2010 64 bits.
How to install Visual C++
You cannot find anymore a standalone package of Visual C++ for modern versions. So you will need to install the Windows SDK itself.
Here are some reference links:
Download Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 from Official Microsoft Download Center: for Visual C++ 15.00 (Visual Studio 2008). Corresponds to WinSDK 7.
Download Microsoft Windows SDK for Windows 7 and .NET Framework 4 from Official Microsoft Download Center: for Visual C++ 16.00 (Visual Studio 2010). Corresponds to WinSDK 7.1.
installation - where can I download the full installer for Visual C++ Express? - Super User
Visual Studio & co. downloads
Troubleshooting
You might have an error at the installation of the 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.
They have been reported in several questions already:
Windows 7 SDK Installation Failure
Error installing Windows 7 SDK 7.1 with VS2008, VS2010 Premium on Win 7 32bit
As a solution, you can check this link: Windows SDK Fails to Install with Return Code 5100
The thing is to remove all conflicting (understand: the ones that the SDK installer tries to install itself) version of the Visual C++ redistributable.
Use development tools
Normally you should run vsvarsall.bat (located inside the VC folder of the installation path of Visual Studio - example: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat) to set up the proper environment variables so that the execution of distutils doesn't fail when trying to compile a package.
This batch script accepts a parameter, which should set the wanted architecture. However I saw that with the free versions of the SDK some additional scripts were missing when trying several of these parameters.
Just to say that if you are compiling for a 32 bits architecture, simply calling vsvarsall.bat should work. If you need to compile for 64 bits, you can directly call SetEnv.cmd, located somewhere under inside the SDK installation path - example: "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64.
On Windows, pip is great for installing packages that do not require compiling. Otherwise, seriously, save yourself the hassle of building and maintaining packages, and take advantage of the work others did for you. I recommend using either of these Python distributions:
ActivePython
Anaconda
Anaconda is a little larger to download and install, but it includes many useful third-party packages by default (such as numpy). ActivePython includes a package manager which allows you to easily install pre-compiled binaries (installing numpy is as easy as pypm install numpy).
The advantage of using these Python distributions is that you can get a working installation running in minutes, in an easily reproducible manner.
Best solution for this is to download and install VCforPython2.7 from https://www.microsoft.com/en-us/download/details.aspx?id=44266
Then try pip install numpy.
100% working
I tried to install numpy for windows 7, 64-bit and spent quite sometime. I was actually trying to setup sklearn. Researched many posts, documented what worked for me. Hope it saves your time!
https://simplemachinelearning.wordpress.com/2015/11/09/set-up-sklearn-on-windows/
I too faced the above problem while setting up python for machine learning.
I followed the below steps :-
Install python-2.7.13.msi
• set PATH=C:\Python27
• set PATH=C:\Python27\Scripts
Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
Downloaded:- • numpy-1.13.1+mkl-cp27-cp27m-win32.whl
• scipy-0.18.0-cp27-cp27m-win32.whl
Installing numpy:
pip install numpy-1.13.1+mkl-cp27-cp27m-win32.whl
Installing scipy:
pip install scipy-0.18.0-cp27-cp27m-win32.whl
You can test the correctness using below cmds:-
>>> import numpy
>>> import scipy
>>> import sklearn
>>> numpy.version.version
'1.13.1'
>>> scipy.version.version
'0.19.1'
>>>

PyCrypto install error on Windows

I am trying to install PyCrypto 2.6 Library on my computer. But I keep getting the following error
D:\Software\Python\package\pycrypto-2.6>python setup.py build
running build
running build_py
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Random.OSRNG.winrandom' extension
error: Unable to find vcvarsall.bat
My System has
Windows 8 Pro 64-bit, Visual Studio Enterprise 2012 and Python 3.3
To fix the error I tried to set the Environment Variable VS90COMNTOOLS=%VS110COMNTOOLS% as advised by fmuecke in the post error: Unable to find vcvarsall.bat but it didn't work for me.
Can any one please advise me how to fix this error.
FYI, I don't to install VC2008 etc..
I managed to install PyCrypto 2.6 by using the prebuilt binary for Python3.3 from The Voidspace Python Modules.
It doesn't actually fix the error: Unable to find vcvarsall.bat for other package which don't have a prebuilt binaries available.
However it eliminates the need to build PyCrypto package, allowing me to install PyCrypto on my system without getting the error.
I've just used
https://www.microsoft.com/en-gb/download/details.aspx?id=44266
with setuptools > 6.0 and run
'pip install pycrypto'
and it worked
I know this is an old question, but I also need today much time to get paramiko wokring.
I want to use Python 3.4 and on voidspace, there are no prebuild binaries for 3.4.
Finally, I got a wokring pycrypto by installing "Microsoft Studio Express 2010 C++" and run from the pycrypto 2.7 folder:
python setup.py build --compiler msvc
python setup.py install
python setup.py bdist_wininst
All the "tricks" with enviroment variables doesn't work for me.
If it helps somebody, all the thanks goes to:
http://flintux.wordpress.com/2014/04/30/pycrypto-for-python-3-4-on-windows-7-64bit/
For Python 3.5 you can do this:
Install a PyCrypto binary from this site :
https://github.com/sfbahr/PyCrypto-Wheels
The best way to do it, is:
64bits Python
c:\Python35\Scripts\pip.exe install --use-wheel --no-index --find-links=https://github.com/sfbahr/PyCrypto-Wheels/raw/master/pycrypto-2.6.1-cp35-none-win_amd64.whl pycrypto
32bits Python
c:\Python35\Scripts\pip.exe install --use-wheel --no-index --find-links=https://github.com/sfbahr/PyCrypto-Wheels/raw/master/pycrypto-2.6.1-cp35-none-win32.whl pycrypto
Of course replace c:\Python35\Scripts\pip.exe by your python pip path
To know your python version, run python and look at the architecture displayed between brackets:
C:\Users\utilisateur>python
Python 3.5.1 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Hope this can help.
You may install mingw64 and then run from the PyCrypto unzipped files directory:
python setup.py build --compiler=mingw32
Updated answer for 2021 (many other answers are outdated)
Python 2.7 is EOL (end-of-life), and Microsoft has removed the download link for the Visual C++ 8.0 compiler, which was needed for compiling native Python 2.7 modules (and which they later called something like "C++ compiler for Python 2.7", VCForPython27.msi). Therefore pip install pycrypto no longer works.
To see for yourserlf, check out this answer with a now defunct download link. Don't search for VCForPython27 on GitHub - you will find projects, but they are not official Microsoft projects, so you may want to stay away from those.
If you find yourself in this situation, then seriously, it's high time to migrate to Python 3. Don't download old builds of PyCrypto or Visual C++ 8.0 from random websites or from web archive links, especially not since this is a library for cryptography that should be kept up to date.
I am using Windows 10 - All I needed to do was update my system with Visual C++ Build Tools 2015 which I found on this page: https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/
About mid-page, you will see some download options - choose your python version and download the correct package
I then re-imported the program I was trying to install and NO more error! Woohoo!
if you are
VS 2010
SET VS90COMNTOOLS=%VS100COMNTOOLS%
VS 2012
SET VS90COMNTOOLS=%VS110COMNTOOLS%
VS 2013
SET VS90COMNTOOLS=%VS120COMNTOOLS%
and then
python setup.py install

How do I install SciPy on 64 bit Windows?

How do I install SciPy on my system?
For the NumPy part (that SciPy depends on) there is actually an installer for 64 bit Windows: numpy-1.3.0.win-amd64-py2.6.msi (is direct download URL, 2310144 bytes).
Running the SciPy superpack installer results in this
message in a dialog box:
Cannot install. Python version 2.6 required, which was not found in the registry.
I already have Python 2.6.2 installed (and a working Django installation
in it), but I don't know about any Registry story.
The registry entries seem to already exist:
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Python]
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore]
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6]
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\Help]
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\Help\Main Python Documentation]
#="D:\\Python262\\Doc\\python262.chm"
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\InstallPath]
#="D:\\Python262\\"
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\InstallPath\InstallGroup]
#="Python 2.6"
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\Modules]
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\PythonPath]
#="D:\\Python262\\Lib;D:\\Python262\\DLLs;D:\\Python262\\Lib\\lib-tk"
What I have done so far:
Step 1
Downloaded the NumPy superpack installer
numpy-1.3.0rc2-win32-superpack-python2.6.exe
(direct download URL, 4782592 bytes). Running this installer
resulted in the same message, "Cannot install. Python
version 2.6 required, which was not found in the registry.".
Update: there is actually an installer for NumPy that works - see beginning of the question.
Step 2
Tried to install NumPy in another way. Downloaded the zip
package numpy-1.3.0rc2.zip (direct download URL, 2404011 bytes),
extracted the zip file in a normal way to a temporary
directory, D:\temp7\numpy-1.3.0rc2 (where setup.py and
README.txt is). I then opened a command line window and:
d:
cd D:\temp7\numpy-1.3.0rc2
setup.py install
This ran for a long time and also included use of cl.exe
(part of Visual Studio). Here is a nearly 5000 lines long
transcript (230 KB).
This seemed to work. I can now do this in Python:
import numpy as np
np.random.random(10)
with this result:
array([ 0.35667511, 0.56099423, 0.38423629, 0.09733172, 0.81560421,
0.18813222, 0.10566666, 0.84968066, 0.79472597, 0.30997724])
Step 3
Downloaded the SciPy superpack installer, scipy-0.7.1rc3-
win32-superpack-python2.6.exe (direct download URL, 45597175
bytes). Running this installer resulted in the message
listed in the beginning
Step 4
Tried to install SciPy in another way. Downloaded the zip
package scipy-0.7.1rc3.zip (direct download URL, 5506562
bytes), extracted the zip file in a normal way to a
temporary directory, D:\temp7\scipy-0.7.1 (where setup.py
and README.txt is). I then opened a command line window and:
d:
cd D:\temp7\scipy-0.7.1
setup.py install
This did not achieve much - here is a transcript (about 95
lines).
And it fails:
>>> import scipy as sp2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named scipy
Platform: Python 2.6.2 installed in directory D:\Python262,
Windows XP 64 bit SP2, 8 GB RAM, Visual Studio 2008
Professional Edition installed.
The startup screen of the installed Python is:
Python 2.6.2 (r262:71605, Apr 14 2009, 22:46:50) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Value of PATH, result from SET in a command line window:
Path=D:\Perl64\site\bin;D:\Perl64\bin;C:\Program Files (x86)\PC Connectivity Solution\;D:\Perl\site\bin;D:\Perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;d:\Program Files (x86)\WinSCP\;D:\MassLynx\;D:\Program Files (x86)\Analyst\bin;d:\Python262;d:\Python262\Scripts;D:\Program Files (x86)\TortoiseSVN\bin;D:\Program Files\TortoiseSVN\bin;C:\WINDOWS\system32\WindowsPowerShell\v1.0;D:\Program Files (x86)\IDM Computer Solutions\UltraEdit\
Unofficial 64-bit installers for NumPy and SciPy are available at http://www.lfd.uci.edu/~gohlke/pythonlibs/
Make sure that you download & install the packages (aka. wheels) that match your CPython version and bitness (ie. cp35 = Python v3.5; win_amd64 = x86_64).
You'll want to install NumPy first; From a CMD prompt with administrator privileges for a system-wide (aka. Program Files) install:
C:\>pip install numpy‑<version>+mkl‑cp<ver-spec>‑cp<ver-spec>m‑<cpu-build>.whl
Or include the --user flag to install to the current user's application folder (Typically %APPDATA%\Python on Windows) from a non-admin CMD prompt:
C:\>pip install --user numpy‑<version>+mkl‑cp<ver-spec>‑cp<ver-spec>m‑<cpu-build>.whl
Then do the same for SciPy:
C:\>pip install [--user] scipy‑<version>‑cp<ver-spec>‑cp<ver-spec>m‑<cpu-build>.whl
Don't forget to replace <version>, <ver-spec>, and <cpu-build> appropriately if you copy & paste any of these examples. And also that you must use the numpy & scipy packages from the ifd.uci.edu link above (or else you will get errors if you try to mix & match incompatible packages -- uninstall any conflicting packages first [ie. pip list]).
Short answer: Windows 64 bit support is still work in progress at this time. The superpack will certainly not work on a 64-bits Python (but it should work fine on a 32 bits Python, even on Windows 64 bit).
The main issue with Windows 64 bit is that building with mingw-w64 is not stable at this point: it may be our's (NumPy developers) fault, Python's fault or mingw-w64. Most likely a combination of all those :). So you have to use proprietary compilers: anything other than the Microsoft compiler crashes NumPy randomly; for the Fortran compiler, ifort is the one to use. As of today, both NumPy and SciPy source code can be compiled with Visual Studio 2008 and ifort (all tests passing), but building it is still quite a pain, and not well supported by the NumPy build infrastructure.
As the transcript for SciPy told you, SciPy isn't really supposed to work on Win64:
Warning: Windows 64 bits support is experimental, and only available for
testing. You are advised not to use it for production.
So I would suggest to install the 32-bit version of Python, and stop attempting to build SciPy yourself. If you still want to try anyway, you first need to compile BLAS and LAPACK, as PiotrLegnica says. See the transcript for the places where it was looking for compiled versions of these libraries.
WinPython is an open-source distribution that has 64-bit NumPy and SciPy.
Another alternative: http://www.pythonxy.com/
Free and includes lots of stuff meant to work together smoothly.
This person says
Did you try linux.pythonxy ? ( http://linux.pythonxy.com ).
It's 64 bit ready ...
Though I'm not quite sure what that means.
Update:
This appears to be dead. I use Anaconda now, which has 32-bit or 64-bit installers.
For completeness: Enthought has a Python distribution which includes SciPy; however, it's not free. Caveat: I've never used it.
Update: This answer had been long forgotten until an upvote brought me back to it. At this time, I'll second endolith's suggestion of Anaconda, which is free.
Try to install Python 2.6.3 over your 2.6.2 (this should also add correct Registry entry), or to register your existing installation using this script. Installer should work after that.
Building SciPy requires a Fortran compiler and libraries - BLAS and LAPACK.
It is terrible to install such Python data science packages independently on Windows. Try Anaconda (one installer, 400 more Python packages, py2 & py3 support). Anaconda really helps me a lot!
I have a 32-bit Python 3.5 on a 64-bit Windows 8.1 machine. I just tried almost every way I can find on Stack Overflow and no one works!
Then on here I found it. It says:
SciPy is software for mathematics, science, and engineering.
Requires numpy+mkl.
Install numpy+mkl before installing scipy.
mkl matters!! But nobody said anything about that before!
Then I installed mkl:
C:\Users\****\Desktop\a> pip install mkl_service-1.1.2-cp35-cp35m-win32.whl
Processing c:\users\****\desktop\a\mkl_service-1.1.2-cp35-cp35m-win32.whl
Installing collected packages: mkl-service
Successfully installed mkl-service-1.1.2
Then I installed SciPy:
C:\Users\****\Desktop\a>pip install scipy-0.18.1-cp35-cp35m-win32.whl
Processing c:\users\****\desktop\a\scipy-0.18.1-cp35-cp35m-win32.whl
Installing collected packages: scipy
Successfully installed scipy-0.18.1
It worked~ yeah :)
A tip: You can just google "whl_file_name.whl" to know where to download it~ :)
Update:
After all these steps you will find that you still can not use SciPy in Python 3. If you print "import scipy" you will find there are error messages, but don't worry, there is only one more thing to do. Here
——just comment out that line, simple and useful.
from numpy._distributor_init import NUMPY_MKL
I promise that it is the last thing to do :)
PS: Before all these steps, you better install NumPy first. That's very simple using this command:
pip install numpy
I haven't tried it, but you may want to download this version of Portable Python. It comes with Scipy-0.7.0b1 running on Python 2.5.4.
Install a Python distribution, http://www.python.org/download/.
Download and install the Anaconda Python distribution.
Make the Anaconda Python distribution link to Python 3.3 if you want NumPy, SciPy or Matplotlib to work in Python 3.3, or just use it like that to have only Python 2.7 and older functionality.
The blog post Anaconda Python Distribution Python 3.3 linking provides more detail about Anaconda.
I was getting this same error on a 32-bit machine. I fixed it by registering my Python installation, using the script at:
http://effbot.org/zone/python-register.htm
It's possible that the script would also make the 64-bit superpack installers work.
You can either download a scientific Python distribution. One of the ones mentioned here: https://scipy.org/install.html
Or pip install from a whl file here if the above is not an option for you.
http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
Okay a lot has been said, but just in case nothing of the previous answers work, you can try;
https://www.scipy.org/install.html
According to them;
For most users, especially on Windows, the easiest way to install the packages of the SciPy stack is to download one of these Python
distributions, which include all the key packages:
Anacond: A
free distribution for the SciPy stack. Supports Linux, Windows and
Mac.
Enthought Canopy: The free and commercial versions
include the core SciPy stack packages. Supports Linux, Windows and
Mac.
Python(x,y) A free distribution including the SciPy
stack, based around the Spyder IDE. Windows only.
WinPython: A
free distribution including the SciPy stack. Windows only.
Pyzo: A free distribution based on Anaconda and the IEP interactive
development environment. Supports Linux, Windows and Mac.
Still for me, Anaconda did solve this problem. Do remember to check the bit (32/64 bit) version before downloading and re-adjust your compiler to the Python implementation installed with the Python distribution you are installing.
Okey, here I am going to share what I have done to install SciPy on my Windows PC without the command line.
My PC configuration is Windows 7 64-bit and Python 2.7
First I download the required packages form http://www.lfd.uci.edu/~gohlke/pythonlibs/ (which version match your configuration EX: cp27==>python2.7 & cp35==>3.5)
Second I extract the file using 7-Zip (also can be used any zipper like WinRAR)
Third I copy the scipy folder which I extracted and paste it into C:\Python27\Lib\site-packages (or put it where the exact location is in your PC like ..\..\Lib\site-packages)
NOTE: You have to install NumPy first before installing SciPy in this same way.
I found this solution after days.
Firstly, which Python version you want to install?
If you want for Python 2.7 version:
STEP 1:
scipy‑0.19.0‑cp27‑cp27m‑win32.whl
scipy‑0.19.0‑cp27‑cp27m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp27‑cp27m‑win32.whl
numpy‑1.11.3+mkl‑cp27‑cp27m‑win_amd64.whl
If you want for Python 3.4 version:
scipy‑0.19.0‑cp34‑cp34m‑win32.whl
scipy‑0.19.0‑cp34‑cp34m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp34‑cp34m‑win32.whl
numpy‑1.11.3+mkl‑cp34‑cp34m‑win_amd64.whl
If you want for Python 3.5 version:
scipy‑0.19.0‑cp35‑cp35m‑win32.whl
scipy‑0.19.0‑cp35‑cp35m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp35‑cp35m‑win32.whl
numpy‑1.11.3+mkl‑cp35‑cp35m‑win_amd64.whl
If you want for Python 3.6 version:
scipy‑0.19.0‑cp36‑cp36m‑win32.whl
scipy‑0.19.0‑cp36‑cp36m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp36‑cp36m‑win32.whl
numpy‑1.11.3+mkl‑cp36‑cp36m‑win_amd64.whl
Link: click
Once finishing installation, go to your directory.
For example, my directory:
cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>
pip install [where/is/your/downloaded/scipy_whl.]
STEP 2:
NumPy + MKL
From same web site based on the Python version again:
After that use same thing again in the script folder:
cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>
pip3 install [where/is/your/downloaded/numpy_whl.]
And test it in the Python folder.
Python35>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy

Categories

Resources