5

I'm using virtualenv on Ubuntu 14.04 with Python 2.7.13, and I'm trying to get import pygst to work (I'm a complete Python noob).

I downloaded:
https://gstreamer.freedesktop.org/src/gst-python/gst-python-1.12.1.tar.xz

Compiled and installed with:
./configure --prefix=$VIRTUAL_ENV && make install

However I still cannot import pygst:

>>> import pygst
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pygst

There's also no pip package that matches pygst. I must be missing something really simple, but I can't figure it out.

This does not help either, because it only affects the system Python installation, not virtualenv:

sudo apt-get install python-gst0.10 gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly

How do I install pygst with virtualenv?

Casper
  • 30,513
  • 4
  • 77
  • 72

1 Answers1

2

You need to install the pygst module

sudo apt-get install python-gst0.10 gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly

Then if you want access it in you virtualenv you can make a symlink to your site-packages, just replace 'venv' with the foldername of your virtualenv.

cd venv/lib/python2.7/site-packages
ln -s /usr/lib/python2.7/dist-packages/glib
ln -s /usr/lib/python2.7/dist-packages/gobject
ln -s /usr/lib/python2.7/dist-packages/gst-0.10
ln -s /usr/lib/python2.7/dist-packages/gstoption.so
ln -s /usr/lib/python2.7/dist-packages/gtk-2.0
ln -s /usr/lib/python2.7/dist-packages/pygst.pth
ln -s /usr/lib/python2.7/dist-packages/pygst.py
ln -s /usr/lib/python2.7/dist-packages/pygtk.pth
ln -s /usr/lib/python2.7/dist-packages/pygtk.py
Zaytsev Dmitry
  • 1,627
  • 2
  • 17
  • 29
  • 1
    Ok. I was able to get this to work by accepting that I had to downgrade to pygst 0.10. Two additional changes were needed: 1) Compile Python with `--enable-unicode=ucs4`, 2) `ln -s /usr/lib/python2.7/dist-packages/gi` in the `site-packages` folder. Thanks for your help. – Casper Jul 03 '17 at 08:00