installing PyGObject via pip in virtualenv

MicroCheapFx picture MicroCheapFx · Jul 9, 2015 · Viewed 9.5k times · Source

I'm actually upgrading an old django app from python2.7 to python3.4. While installing pygobject via pip, I got this error:

Collecting pygobject
  Using cached pygobject-2.28.3.tar.bz2
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-9dp0wn96/pygobject/setup.py", line 272
        raise SystemExit, 'ERROR: Nothing to do, gio could not be found and is essential.'
                    ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-9dp0wn96/pygobject

I am trying to install it in a virtualenv. System-wide installation doesn't work either... I am working on arch linux with python3.4

I have installed the arch package named pygobject-devel 3.16.2-1 but I still can't import gobject python module

What is this damned missing gio?

Any help is welcomed... Thanx in advance !

Answer

MicroCheapFx picture MicroCheapFx · Jul 24, 2015

ANSWER IS NOW IN THE POST TAGGED IN COMMENT ABOVE !!!! Have a look there => Python cannot install PyGObject

Ok I just managed it !

To install PyGObject in virtrualenv, give up with pip.

  1. Install PyGObject system-wide (with your package manager or compile it manually). For example, in my case :

    sudo pacman -Suy python-gobject2
    
  2. Link it in your virtualenv :

    ln -s /usr/lib/python3.4/site-packages/gobject* /WHEREVER/IS/YOUR/VIRTUALENV/venv/lib/python3.4/site-packages/
    
  3. You might need to link some other modules (in my case glib) :

    ln -s /usr/lib/python3.4/site-packages/glib* /WHEREVER/IS/YOUR/VIRTUALENV/venv/lib/python3.4/site-packages/
    

You might find some helpful infos about system-wide and virtualenv installations and interactions between modules here :

virtualenv: Specifing which packages to use system-wide vs local