12

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 !

MicroCheapFx
  • 392
  • 1
  • 2
  • 15
  • It could be that you only need to install gi, but I am not sure about it and can't install PyGObject in my virtualenv either. – Zelphir Kaltstahl Jul 23 '15 at 09:11
  • Ok,j I managed to install pyGObject, system-wide with a pre-compiled package, which is the easier way (extra/python-gobject2). The upper error is a simple Syntax error, because setup.py for this pip package is only designed for Windows anyway... I have to run some tests and experiment to manage to use it in virtualenv. – MicroCheapFx Jul 24 '15 at 11:06
  • 1
    According to [the answer here](http://stackoverflow.com/a/38219461/339144) this is now possible. I did not check this myself. – Klaas van Schelven Feb 10 '17 at 15:34
  • @KlaasvanSchelven You're right ! Thank you ! – MicroCheapFx Feb 13 '17 at 22:18

1 Answers1

7

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

Community
  • 1
  • 1
MicroCheapFx
  • 392
  • 1
  • 2
  • 15