Python version 2.7 required, which was not found in the registry error when attempting to install netCDF4 on Windows 8

Python version 2.7 required, which was not found in the registry error when attempting to install netCDF4 on Windows 8

This error can occur if you are installing a package with a different bitness than your Python version. To see whether your Python installation is 32- or 64-bit, see here.

Some superpacks (e.g. for Scipy) available on SourceForge or python.org are for 32-bit systems and some are for 64-bit systems. See this answer. In Windows, uninstalling the 32-bit and installing the 64-bit version (or vice versa if your installation is 32-bit) can solve the problem.

I had the same issue when using an .exe to install a Python package (because I use Anaconda and it didnt add Python to the registry). I fixed the problem by running this script:

#
# script to register Python 2.0 or later for use with 
# Python extensions that require Python registry settings
#
# written by Joakim Loew for Secret Labs AB / PythonWare
#
# source:
# http://www.pythonware.com/products/works/articles/regpy20.htm
#
# modified by Valentine Gogichashvili as described in http://www.mail-archive.com/[email protected]/msg10512.html

import sys

from _winreg import *

# tweak as necessary
version = sys.version[:3]
installpath = sys.prefix

regpath = SOFTWARE\Python\Pythoncore\%s\ % (version)
installkey = InstallPath
pythonkey = PythonPath
pythonpath = %s;%s\Lib\;%s\DLLs\ % (
    installpath, installpath, installpath
)

def RegisterPy():
    try:
        reg = OpenKey(HKEY_CURRENT_USER, regpath)
    except EnvironmentError as e:
        try:
            reg = CreateKey(HKEY_CURRENT_USER, regpath)
            SetValue(reg, installkey, REG_SZ, installpath)
            SetValue(reg, pythonkey, REG_SZ, pythonpath)
            CloseKey(reg)
        except:
            print *** Unable to register!
            return
        print --- Python, version, is now registered!
        return
    if (QueryValue(reg, installkey) == installpath and
        QueryValue(reg, pythonkey) == pythonpath):
        CloseKey(reg)
        print === Python, version, is already registered!
        return
    CloseKey(reg)
    print *** Unable to register!
    print *** You probably have another Python installation!

if __name__ == __main__:
    RegisterPy()

Python version 2.7 required, which was not found in the registry error when attempting to install netCDF4 on Windows 8

Try the steps described here:
http://avaminzhang.wordpress.com/2011/11/24/python-version-2-7-required-which-was-not-found-in-the-registry/

Leave a Reply

Your email address will not be published. Required fields are marked *