18

I want to install the Pygobject package on my Ubuntu 13.10. I tried the JHBuild option but I got stuck at the end of a very lengthy process.

The tutorial website of Pygobject says that it comes packaged with all its dependencies for nearly all Linux distros and it can be installed from the official repository of a distribution.

I looked for it on the software center but couldn't find it. All it returned it was some spellchecking libraries and development headers for gobject python bindings(I am a beginner so please let me know if this is what I need to build pygtk applications in python 3.3.2) .

I am guessing this needs to be installed using the command line interface but can't figure out how.

1

2 Answers 2

16

Development libraries usually don't show up very well in the software center. Usually using apt-cache search will help here. So for example:

apt-cache search python gobject

Will show you all the packages related to python and gobject introspection. Here is a snippet of the results:

python-gi - Python 2.x bindings for gobject-introspection libraries
python-gi-cairo - Python Cairo bindings for the GObject library
python-gi-dbg - Python bindings for the GObject library (debug extension)
python-gi-dev - development headers for GObject Python bindings
python-gobject - Python 2.x bindings for GObject - transitional package
python-gobject-2 - deprecated static Python bindings for the GObject library
python-gobject-2-dbg - deprecated static Python bindings for the GObject library (debug extension)
python-gobject-2-dev - development headers for the static GObject Python bindings
python-gobject-dbg - Python 2.x debugging modules for GObject - transitional package
python-gobject-dev - Python 2.x development headers for GObject - transitional package
python-pyudev - Python bindings for libudev
python3-gi - Python 3 bindings for gobject-introspection libraries
python3-gi-cairo - Python 3 Cairo bindings for the GObject library
python3-gi-dbg - Python 3 bindings for gobject-introspection libraries (debug extension)
python3-pyudev - Python3 bindings for libudev

Since you are looking for python 3 I would install python3-gi, that's probably the package you are looking for, so ...

sudo apt-get install python3-gi
7
  • Yep, I have updated my answer. Commented Feb 12, 2014 at 15:13
  • You should answer with only the suggestion to install the -gi package, either for python 2 or python 3, as it's the preferred way to write gobject code in python, and the old pygobject bindings are deprecated. Also, you should suggest to install the gir1.2-foo package for any library you wish to use from python with gi.
    – dobey
    Commented Feb 12, 2014 at 15:16
  • @dobey Feel free to just edit my answer! Commented Feb 12, 2014 at 15:28
  • this solved it for me: sudo apt install -y python-gi-dev
    – rofrol
    Commented Sep 13, 2017 at 9:50
  • sudo -H pip3 install PyGObject
    – Laurenz
    Commented Aug 3, 2019 at 15:09
1

Currently (>=python3.5) you should use pip. For example,

python -m pip install --user pygobject

I recommend the --user option to avoid permission problems and the awkward use of sudo (See this question).

You might get an installation error. In that case, it helps installing libgirepository1.0-dev either with the Package Manager or in command line with

sudo apt-get install libgirepository1.0-dev

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .