Ubuntu 13.04 errors with Python PIP install

pippythonUbuntuubuntu-13.04

After trying to use Ubuntu 13.04 instead of Ubuntu 12.10 to run my Chef recepis against I am getting an error when it tries to run sudo pip install cElementTree supervisor

STDOUT: Downloading/unpacking cElementTree
  Running setup.py egg_info for package cElementTree

Downloading/unpacking supervisor
  Running setup.py egg_info for package supervisor

Requirement already satisfied (use --upgrade to upgrade): distribute in /usr/local/lib/python2.7/dist-packages/distribute-0.6.45-py2.7.egg (from supervisor)
Downloading/unpacking meld3>=0.6.5 (from supervisor)
  Running setup.py egg_info for package meld3

Installing collected packages: cElementTree, supervisor, meld3
  Running setup.py install for cElementTree
    building 'cElementTree' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DXML_STATIC -DXML_NS=1 -DXML_DTD=1 -DBYTEORDER=1234 -DXML_CONTEXT_BYTES=1024 -Iexpat -I/usr/include/python2.7 -c cElementTree.c -o build/temp.linux-x86_64-2.7/cElementTree.o
    cElementTree.c:1368:5: warning: initialization from incompatible pointer type [enabled by default]
    cElementTree.c:1368:5: warning: (near initialization for 'element_as_sequence.sq_length') [enabled by default]
    cElementTree.c:1371:5: warning: 'intargfunc' is deprecated [-Wdeprecated-declarations]
    cElementTree.c:1371:5: warning: initialization from incompatible pointer type [enabled by default]
    cElementTree.c:1371:5: warning: (near initialization for 'element_as_sequence.sq_item') [enabled by default]
    cElementTree.c:1372:5: warning: 'intintargfunc' is deprecated [-Wdeprecated-declarations]
    cElementTree.c:1372:5: warning: initialization from incompatible pointer type [enabled by default]
    cElementTree.c:1372:5: warning: (near initialization for 'element_as_sequence.sq_slice') [enabled by default]
    cElementTree.c:1373:5: warning: initialization from incompatible pointer type [enabled by default]
    cElementTree.c:1373:5: warning: (near initialization for 'element_as_sequence.sq_ass_item') [enabled by default]
    cElementTree.c:1374:5: warning: initialization from incompatible pointer type [enabled by default]
    cElementTree.c:1374:5: warning: (near initialization for 'element_as_sequence.sq_ass_slice') [enabled by default]
    cElementTree.c: In function 'expat_unknown_encoding_handler':
    cElementTree.c:2143:5: warning: pointer targets in passing argument 1 of 'PyUnicodeUCS4_Decode' differ in signedness [-Wpointer-sign]
    In file included from /usr/include/python2.7/Python.h:85:0,
                     from cElementTree.c:44:
    /usr/include/python2.7/unicodeobject.h:685:23: note: expected 'const char *' but argument is of type 'unsigned char *'
    cElementTree.c: In function 'xmlparser':
    cElementTree.c:2181:38: warning: passing argument 4 of 'PyArg_ParseTupleAndKeywords' from incompatible pointer type [enabled by default]
    In file included from /usr/include/python2.7/Python.h:126:0,
                     from cElementTree.c:44:
    /usr/include/python2.7/modsupport.h:28:17: note: expected 'char **' but argument is of type 'const char **'
    cElementTree.c: In function 'initcElementTree':
    cElementTree.c:2573:15: warning: variable 'm' set but not used [-Wunused-but-set-variable]
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DXML_STATIC -DXML_NS=1 -DXML_DTD=1 -DBYTEORDER=1234 -DXML_CONTEXT_BYTES=1024 -Iexpat -I/usr/include/python2.7 -c expat/xmlparse.c -o build/temp.linux-x86_64-2.7/expat/xmlparse.o
    expat/xmlparse.c:75:2: error: #error memmove does not exist on this platform, nor is a substitute available
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/cElementTree/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-cPAsJo-record/install-record.txt --single-version-externally-managed:
    running install

running build

running build_ext

building 'cElementTree' extension

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DXML_STATIC -DXML_NS=1 -DXML_DTD=1 -DBYTEORDER=1234 -DXML_CONTEXT_BYTES=1024 -Iexpat -I/usr/include/python2.7 -c cElementTree.c -o build/temp.linux-x86_64-2.7/cElementTree.o

cElementTree.c:1368:5: warning: initialization from incompatible pointer type [enabled by default]

cElementTree.c:1368:5: warning: (near initialization for 'element_as_sequence.sq_length') [enabled by default]

cElementTree.c:1371:5: warning: 'intargfunc' is deprecated [-Wdeprecated-declarations]

cElementTree.c:1371:5: warning: initialization from incompatible pointer type [enabled by default]

cElementTree.c:1371:5: warning: (near initialization for 'element_as_sequence.sq_item') [enabled by default]

cElementTree.c:1372:5: warning: 'intintargfunc' is deprecated [-Wdeprecated-declarations]

cElementTree.c:1372:5: warning: initialization from incompatible pointer type [enabled by default]

cElementTree.c:1372:5: warning: (near initialization for 'element_as_sequence.sq_slice') [enabled by default]

cElementTree.c:1373:5: warning: initialization from incompatible pointer type [enabled by default]

cElementTree.c:1373:5: warning: (near initialization for 'element_as_sequence.sq_ass_item') [enabled by default]

cElementTree.c:1374:5: warning: initialization from incompatible pointer type [enabled by default]

cElementTree.c:1374:5: warning: (near initialization for 'element_as_sequence.sq_ass_slice') [enabled by default]

cElementTree.c: In function 'expat_unknown_encoding_handler':

cElementTree.c:2143:5: warning: pointer targets in passing argument 1 of 'PyUnicodeUCS4_Decode' differ in signedness [-Wpointer-sign]

In file included from /usr/include/python2.7/Python.h:85:0,

                 from cElementTree.c:44:

/usr/include/python2.7/unicodeobject.h:685:23: note: expected 'const char *' but argument is of type 'unsigned char *'

cElementTree.c: In function 'xmlparser':

cElementTree.c:2181:38: warning: passing argument 4 of 'PyArg_ParseTupleAndKeywords' from incompatible pointer type [enabled by default]

In file included from /usr/include/python2.7/Python.h:126:0,

                 from cElementTree.c:44:

/usr/include/python2.7/modsupport.h:28:17: note: expected 'char **' but argument is of type 'const char **'

cElementTree.c: In function 'initcElementTree':

cElementTree.c:2573:15: warning: variable 'm' set but not used [-Wunused-but-set-variable]

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DXML_STATIC -DXML_NS=1 -DXML_DTD=1 -DBYTEORDER=1234 -DXML_CONTEXT_BYTES=1024 -Iexpat -I/usr/include/python2.7 -c expat/xmlparse.c -o build/temp.linux-x86_64-2.7/expat/xmlparse.o

expat/xmlparse.c:75:2: error: #error memmove does not exist on this platform, nor is a substitute available

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Any ideas?

Edit: Actually this has also started to happen on 12.10, since destroying my vagrant box and rolling back to 12.10 has not got rid of this error.

Best Answer

Make backup of /usr/include/python2.7/pyconfig.h

And replace this file with /usr/include/x86_64-linux-gnu/python2.7/pyconfig.h

This is temporary method. I think if Distribute package or Ubuntu is updated then this problem will be solved automatically.