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

Question:

I use Anaconda 1.7, 32 bit. I downloaded the correct version of the netCDF4 installer from here.

I attempted to copy the HKEY_LOCAL_MACHINESOFTWAREPython folder into HKEY_LOCAL_MACHINESOFTWAREWow6432Node. No luck.

Does anyone have any idea why this might be happening? Anaconda installed in the default location, C:/.

Yes, I know Anaconda has netCDF4 in the packages list – but if you look closely, it’s only offered for Mac and Linux.

Asked By: bogdan

||

Answers:

Just download Python 2.7.6 Windows Installer from the official Python download page, and launch the install package.

Answered By: pepr

I had such problem. Solution was simple :

  1. Install python 2.7 64bit version.
  2. Export HKEY_LOCAL_MACHINESOFTWAREPython.
  3. Remove Python 2.7.
  4. insert exported reg file.
  5. rename all C:Python27 to C:Anaconda ( insert your path ).

P.S. Sorry, for bad grammar.

Answered By: user

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.

Answered By: 1''

I had the same issue when using an .exe to install a Python package (because I use Anaconda and it didn’t 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()
Answered By: duhaime

I think it really depends on why this error is given. It may be the bitness issue, but it may also be because of a deinstaller bug that leaves registry entries behind.

I just had this case because I need two versions of Python on my system. When I tried to install SCons (using Python2), the .msi installer failed, saying it only found Python3 in the registry. So I uninstalled it, with the result that no Python was found at all. Frustrating! (workaround: install SCons with pip install --egg --upgrade scons)

Anyway, I’m sure there are threads on that phenomenon. I just thought it would fit here because this was one of my top search results.

Answered By: Sir Jane

Check for the 32/64 bit you trying to install. both python interpreter and your app which trying to use python might be of different bit.

Answered By: ADITYA RATHI