jhcore.com

18 Jun, 2008

pymedia on Ubuntu Hardy Heron

Posted by: john In: Guides| Ubuntu

Recently, I needed to use pymedia, for some audio and video encoding. The problem though, is that pymedia was nowhere to be found in the Ubuntu Hardy Heron package repository, and the only .deb installation candidate from the pymedia website was for an older version of pymedia and Python 2.4. Not wanting to run an old version and having Python 2.5 as a requirement, I needed to compile the package myself–no easy task, it turns out.

Step 1. Get pymedia

wget http://internap.dl.sourceforge.net/sourceforge/pymedia/pymedia-1.3.7.3.tar.gz
tar xzvf pymedia-1.3.7.3.tar.gz
cd pymedia-*

Step 2: Get the pymedia dependencies (as noted here).

sudo apt-get install python-dev libogg-dev libvorbis-dev liblame-dev libfaad-dev libasound2-dev python-pygame

Step 3. Get GCC 3.4 (pymedia will not compile with GCC 4.0)

sudo apt-get install gcc-3.4 g++-3.4
export CC=gcc-3.4

Step 4. Build/compile pymedia

python setup.py build

Step 5. Be a good Ubuntu user with checkinstall
Checkinstall is great because it installs the package as a .deb file.

sudo apt-get install checkinstall
sudo checkinstall python setup.py install

Note: If you want to be a bad Ubuntu user, you can run “sudo python setup.py install” instead of the checkinstall command.

Step 6. Try it out

python
>>> import pymedia

13 Responses to "pymedia on Ubuntu Hardy Heron"

1 | Luis

June 26th, 2008 at 10:13 am

Hi, i made your tutorial, but when i try: python setup.py build, i get this error:
unable to execute g++: No such file or directory
error: command ‘g++’ failed with exit status 1

In otherhand when i try to install gcc-3.4 and g++-3.4 i get this:
Leyendo lista de paquetes… Hecho
Creando árbol de dependencias
Leyendo la información de estado… Hecho
gcc-3.4 ya está en su versión más reciente.
g++-3.4 ya está en su versión más reciente.
Se instalaron de forma automática los siguientes paquetes y ya no son necesarios.
faad lame
Utilice «apt-get autoremove» para eliminarlos.
0 actualizados, 0 se instalarán, 0 para eliminar y 0 no actualizados.

So what can i do ???? Help please

2 | Justin Hernandez

June 26th, 2008 at 3:49 pm

You have to type “export CC=gcc-3.4″ before you build.

3 | Luis

June 26th, 2008 at 4:49 pm

Yes, i type “export CC=gcc-3.4″ before i build, and i get that error

4 | Michael

July 9th, 2008 at 6:36 am

I just went into /usr/bin as root and did
ln -s gcc-3.4 gcc
ln -s g++-3.4 g++

Worked fine after that.

Thanks for the guide. :)

5 | gaskell.org » Installing pymedia on Ubuntu

July 9th, 2008 at 10:51 pm

[...] I was wasn’t able to get it to build using the official docs. Fortunately I found a couple of great blog posts. I ended up having to make a couple of [...]

6 | Thura

August 8th, 2008 at 5:50 am

Thanks, this post really help me ….

7 | Pine

August 8th, 2008 at 6:19 am

This didn’t help me at all. I tried gcc-3.4 and gcc-3.3 with the exact same errors as gcc-4.

8 | djmonteshaker

August 11th, 2008 at 12:28 am

I am kind of a newbie at this and I had issues too.
i get an error at step 4.`I tried creating the directories in /usr/bin/ but that did help.
this is the error i get.
root@elo:~/pymedia-1.3.7.3/pymedia-1.3.7.3# python setup.py build
Using UNIX configuration…

OGG : found
VORBIS : found
FAAD : found
MP3LAME : found
VORBISENC : found
ALSA : found
Continue building pymedia ? [Y,n]:yes
running build
running build_py
running build_ext
building ‘pymedia.audio.sound’ extension
g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-i686-2.5/sound/sound.o build/temp.linux-i686-2.5/sound/resample.o build/temp.linux-i686-2.5/sound/fft.o -logg -lvorbis -lfaad -lmp3lame -lvorbisenc -lasound -o build/lib.linux-i686-2.5/pymedia/audio/sound.so
unable to execute g++: No such file or directory
error: command ‘g++’ failed with exit status 1

Can anyone guide me in the right direction??thanks

9 | djmonteshaker

August 11th, 2008 at 12:43 am

nevermind… I took the ln commands as in…

10 | phatd

August 11th, 2008 at 7:25 pm

i cant seem to get python to import it. i noticed that is says 4.2.3 ( as below) how do i run it through gcc 3.4? i ran the export command. But i am a little lost on this

root@LinuxTab:~$ python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import pymedia
>>>

Any clues?

11 | N Taylor

September 13th, 2008 at 4:49 pm

Forget the rest. You da best!

Thanks man - your tutorial solved the parts other sites couldn’t reach.

Worked like a charm.

12 | Vadim

October 27th, 2008 at 5:05 pm

You may also need:

export CFLAGS=-fPIC
export CXX=g++-3.4

I had to add:

#include

as first line of audio/inttypes.h

after that it fails during compilation on 64 bit machine:
gcc-3.4 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DBUILD_NUM=1875 -DPATH_DEV_DSP=”/dev/dsp” -DPATH_DEV_MIXER=”/dev/mixer” -D_FILE_OFFSET_BITS=64 -DACCEL_DETECT=1 -DHAVE_MMX=1 -DHAVE_LINUX_DVD_STRUCT=1 -DDVD_STRUCT_IN_LINUX_CDROM_H=1 -DCONFIG_VORBIS -DCONFIG_VORBIS -DCONFIG_FAAD -DCONFIG_MP3LAME -DCONFIG_VORBIS -DCONFIG_ALSA -DHAVE_AV_CONFIG_H -DUDF_CACHE=1 -INone -INone -INone -I/usr/include/lame -INone -INone -I/home/lord/tmp/pymedia-1.3.7.3 -Ivideo/ -I/usr/include/python2.5 -c video/libavcodec/i386/cputest.c -o build/temp.linux-x86_64-2.5/video/libavcodec/i386/cputest.o
/tmp/ccoIDfcQ.s: Assembler messages:
/tmp/ccoIDfcQ.s:20: Error: suffix or operands invalid for `pop’
/tmp/ccoIDfcQ.s:23: Error: suffix or operands invalid for `push’
/tmp/ccoIDfcQ.s:26: Error: suffix or operands invalid for `pop’

13 | Morten Lund

November 7th, 2008 at 6:28 am

I am having the exact same problem as Vadim on a fresh 64bit ubuntu 8.04 install. Any suggestion on how this can be solved would be appreciated.

Comment Form

Categories


  • Ajay: Sorry forgot to mention it ubuntu 64 bit
  • Ajay: I got eclipse up on Sun-jdk6/ubuntu 8.10 . but when I got to Windows --> preferences -- I dont see an option for Java or anything related to java .
  • Bruce Clement: Thanks for the excellent page. One update though, the Pydev URL you give has gone 403. http://pydev.sourceforge.net/ still works though.

About

A source for news, reviews, guides, and tools for technology by John Paulett. Featured on Planet Ubuntu Users.

Also check out: