Monthly Archives: April 2014

Python ‘pip’ and Windows registry corruption


In my recent post about setting up a 64 bit Windows Django development environment, I described an initial problem with Virtualenv which then led me through a whole series of problems and fixes and finally to what I thought was a working 64 bit Python development environment. However, I recently realised that the original underlying issue still remained, such that any attempt to install a new package using pip would result in failure due to that same error message.

For example, when I tried to install Beautiful Soup via pip, I got the following error:

C:\> pip install beautifulsoup4
Downloading/unpacking beautifulsoup4
Cleaning up...
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\", line 122, in main
status =, args)
File "C:\Python27\lib\site-packages\pip\commands\", line 278, in run

requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundl
File "C:\Python27\lib\site-packages\pip\", line 1229, in prepare_files
File "C:\Python27\lib\site-packages\pip\", line 292, in run_egg_info
logger.notify('Running (path:%s) egg_info for package %s' % (self.s
File "C:\Python27\lib\site-packages\pip\", line 265, in setup_py
import setuptools
File "C:\Python27\lib\site-packages\setuptools\", line 12, in
from setuptools.extension import Extension
File "C:\Python27\lib\site-packages\setuptools\", line 7, in
from setuptools.dist import _get_unpatched
File "C:\Python27\lib\site-packages\setuptools\", line 15, in
from setuptools.compat import numeric_types, basestring
File "C:\Python27\lib\site-packages\setuptools\", line 19, in
from SimpleHTTPServer import SimpleHTTPRequestHandler
File "C:\Python27\lib\", line 27, in
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
File "C:\Python27\lib\", line 208, in SimpleHTTPRequestHand
mimetypes.init() # try to read system mime.types
File "C:\Python27\lib\", line 361, in init
File "C:\Python27\lib\", line 263, in read_windows_registry
with _winreg.OpenKey(hkcr, subkeyname) as subkey:
TypeError: must be string without null bytes or None, not str

Continue reading Python ‘pip’ and Windows registry corruption