importing pygame on python3 on virtualenv cause ImportError
Question: I have python3.3.1 on ubuntu lucid,which I invoke thru virtualenvwrapper ' .I
wanted to learn pygame,so I used pip to install it.Before that I installed the
sdl and smpeg dev libraries

    
    
    me@ubuntu: sudo apt-get install libsdl1.2-dev
    ...
    me@ubuntu: sudo apt-get install  libsmpeg-dev
    ...
    
    me@ubuntu: workon envpy331
    (envpy331)me@ubuntu:~$ pip install pygame
    
        Downloading pygame-1.9.1release.tar.gz (2.1MB): 2.1MB downloaded
        Running setup.py egg_info for package pygame    
        WARNING, No "Setup" File Exists, Running "config.py"
        Using UNIX configuration...
    
        Hunting dependencies...
        SDL     : found 1.2.14
        FONT    : not found
        IMAGE   : not found
        MIXER   : not found
        SMPEG   : found 0.4.5
        PNG     : found
        JPEG    : found
        SCRAP   : found
        PORTMIDI: not found
        PORTTIME: not found
     ....
       Continuing With "setup.py"  
    
       Successfully installed pygame
       Cleaning up...
    

Then I tried to import pygame and this caused an import error

    
    
    (envpy331)me@ubuntu:~$ python
    Python 3.3.1 (default, Apr 19 2013, 11:41:37) 
    [GCC 4.4.3] on linux
    
    >>> import pygame
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/me/.virtualenvs/envpy331/lib/python3.3/site-packages/pygame/__init__.py", line 95, in <module>
        from pygame.base import *
    ImportError: /home/me/.virtualenvs/envpy331/lib/python3.3/site-packages/pygame/base.cpython-33m.so: undefined symbol: PyCObject_FromVoidPtr
    

Any idea how to correct this?


Answer: Pygame has not been entirely ported to Python 3, only some of the modules. If
you use Python 2.7 everything should work. I recently had the same problem.
Some suggested using individual modules of Pygame with Python 3 but this may
be tricky to set up.

