“Python Version 2.7 required which was not found in the registry”

Introduction
Any module installer that is created using distutils (bdist_wininst) is very likely to produce this error. The problem is that it only detects 32bit installations of Python on 64bit Windows machines. Or more technically, 32bit versions of Python create the following registry path
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Python\PythonCore
while 64bits versions create a slightly other registry path which is
HKEY_CURRENT_USER\Software\Python\PythonCore
When any 32-bit module setup is started (with a Python 64-bit on your system), it first checks whether the first path exists, while instead it should check the second (which does exist).
There are basically three ways of solving this:
- You can install a 32-bit Python version
- or install a 64-bit version of your module
- or adjust the registry such that it really sees that a 64bit Python is installed
I will of course elaborate on the last two options.
Install a 64-bit version of your module
You can find many module binaries here. Choose a 64-bit version and install it. This is the most clean way of fixing the problem.
If your module is not in the list, then try the alternative below.
Fix by adjusting the registry
So the dirty way is to do the following adjustments in the registry:
- Run regedit.
- Locate the path: HKEY_CURRENT_USER\Software\Wow6432Node\
- Create keys in this path: Python\PythonCore\2.7\InstallPath
- Modify the “(Default)“, which is initially empty, to the path where Python is located, for example “C:\Python27\”.
- You are done. Exit and retry the setup that gave the error.
You can alternatively create a .reg file (for example fix.reg) that will do the above steps automatically. Put exactly the following in it:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath] @="C:\\Python27\\"
If you are lazy, then you can also download this file, unpack the registry file and just run it.
Related posts:
- Calling external programs from Python
- “Unable to find vcvarsall.bat” error when trying to install rdflib
- Restore Outlook Account Settings From Second Drive
- “Unable to find vcvarsall.bat” error when trying to install lxml
- How to use cookies with CherryPy