1

After following the instructions How do I install Pygame in virtualenv?, running `pip install pygame' now returns:

Downloading/unpacking pygame
Running setup.py egg_info for package pygame
Skipping module _numericsurfarray for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
Skipping module _numericsndarray for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
Skipping module scrap for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
Skipping module _camera for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.

warning: no files found matching 'readme.txt'
no previously-included directories found matching '*/CVS'
no previously-included directories found matching '*/*/CVS'
Installing collected packages: pygame
Running setup.py install for pygame
Skipping module _numericsurfarray for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
Skipping module _numericsndarray for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
Skipping module scrap for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
Skipping module _camera for Python 3.2.3 (default, Apr 10 2013, 06:11:55)
[GCC 4.6.3] build.
building 'pygame.imageext' extension
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -D_REENTRANT -I/usr/X11R6/include -I/usr/include/SDL -I/usr/include/SDL -I/usr/include -I/usr/include -I/usr/include/python3.2mu -c src/imageext.c -o build/temp.linux-x86_64-3.2/src/imageext.o
In file included from src/imageext.c:47:0:
src/pygame.h:75:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /home/david/.virtualenvs/pywork3/bin/python3.2 -c "import setuptools;__file__='/home/david/.virtualenvs/pywork3/build/pygame/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-0tu3l3-record/install-record.txt --install-headers /home/david/.virtualenvs/pywork3/include/site/python3.2:
Skipping module _numericsurfarray for Python 3.2.3 (default, Apr 10 2013, 06:11:55)

[GCC 4.6.3] build.

Skipping module _numericsndarray for Python 3.2.3 (default, Apr 10 2013, 06:11:55)

[GCC 4.6.3] build.

Skipping module scrap for Python 3.2.3 (default, Apr 10 2013, 06:11:55)

[GCC 4.6.3] build.

Skipping module _camera for Python 3.2.3 (default, Apr 10 2013, 06:11:55)

[GCC 4.6.3] build.

running install

running build

running build_py

running build_ext

building 'pygame.imageext' extension

gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -D_REENTRANT -I/usr/X11R6/include -I/usr/include/SDL -I/usr/include/SDL -I/usr/include -I/usr/include -I/usr/include/python3.2mu -c src/imageext.c -o build/temp.linux-x86_64-3.2/src/imageext.o

In file included from src/imageext.c:47:0:

src/pygame.h:75:20: fatal error: Python.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /home/david/.virtualenvs/pywork3/bin/python3.2 -c "import setuptools;__file__='/home/david/.virtualenvs/pywork3/build/pygame/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-0tu3l3-record/install-record.txt --install-headers /home/david/.virtualenvs/pywork3/include/site/python3.2 failed with error code 1 in /home/david/.virtualenvs/pywork3/build/pygame
Storing complete log in /home/david/.pip/pip.log

Thoughts?

1 Answers1

1

fatal error: Python.h: No such file or directory

Indicates to me that you haven't installed the Python development (headers) package. For Python 2.7 (the default), this is included in python-dev Install python-dev, for the Python 3.2 version you seem to be using this is python3.2-dev Install python3.2-dev. Note that this will only work if you installed Python 3.2 from the Ubuntu packages.

After installation, try again to install the Python package.


The new error you're getting,

error: could not create '/usr/local/lib/python3.2/dist-packages/pygame': Permission denied`

could be because of two reasons:

  • You're not working in a Python virtualenv. Without working in a virtualenv, it will try to install in the system folders (/usr/local/ etc.). Solution: switch to the virtualenv properly, e.g. workon <virtualenvname> and run the pip commands in the same terminal window.

    OR, if you don't intend to work with virtualenvs:

  • You're trying to install it system-wide, but you didn't elevate your privileges to do so. Solution: prepend the pip command with sudo, e.g.

    sudo pip install pygame
    
gertvdijk
  • 69,427