pip install pygame fails on Ubuntu 12.04
On Ubuntu 12.04, I am trying to install pygame in a virtual environment.
sudo aptitude install libsdl1.2-dev libsmpeg-dev libv4l-dev python-virtualenv virtualenv env -p python2.7 . env/bin/activate pip install pygame
However, this produces the compilation error:
src/camera.h:42:32: fatal error: linux/videodev.h: No such file or directory
Installing libv4l-dev produces a file at /usr/include/linux/videodev2.h, but linking /usr/include/linux/videodev.h to /usr/include/linux/videodev2.h produces other compilation errors:
src/camera_v4l.c: In function ‘v4l_open_device’: src/camera_v4l.c:29:29: error: storage size of ‘cap’ isn’t known src/camera_v4l.c:30:23: error: storage size of ‘buf’ isn’t known src/camera_v4l.c:51:24: error: ‘VIDIOCGCAP’ undeclared (first use in this function) src/camera_v4l.c:51:24: note: each undeclared identifier is reported only once for each function it appears in src/camera_v4l.c:63:26: error: ‘VIDIOCGMBUF’ undeclared (first use in this function)
Comments (10)
-
jfinkels reporter
-
Mike Fletcher
Ubuntu's packages for Pygame have 7 patches, including one that strips support for v4linux 1 (leaving v4linux 2). I expect the package will not build without those applied.
-
Charles McLaughlin
@jfinkels One way to get around this is to use Ubuntu's pygame package (apt-get install python-pygame), then use the --system-site-packages option when building your virtualenv.
-
Jason Marshall
- changed version to 1.9.2 (under development)
-
Jason Marshall
- changed version to 1.9.2 (pre-release)
-
gdorn
Another horrible hack which works on Mint 17.1 (derived from Ubuntu 14.something):
cd /usr/include/linux sudo ln -s ../libv4l1-videodev.h videodev.h -
Tariq Kamal
Confirmed that @gdorn's hack works on Crunchbang Waldorf as well for 1.9.1release, so I suspect it'll work with Debian Wheezy, which is where I think my
libv4l-devpackage is from. -
Thomas Kluyver
Pygame is compiling on Ubuntu without any patch for this now, and looking at
camera.hit looks like v4l2 is supported now. -
Thomas Kluyver
- changed status to resolved
-
Thomas Kluyver
- changed version to 1.9.2
- Log in to comment
Sorry for the formatting, I expected the markup interpreter to work the same way as in GitHub.