Dimitrios Desyllas
Dimitrios Desyllas

Reputation: 10032

Pygtk min virtualenv fails to install

I am trying to install pygtk via pip on a GNU/Linux machine with a freshly created virtualenv I try to install pygtk via pip using this command:

pip install pygtk

But I get the following error:

Using cached pygtk-2.24.0.tar.bz2
    Complete output from command python setup.py egg_info:
    ********************************************************************
    * Building PyGTK using distutils is only supported on windows. *
    * To build PyGTK in a supported way, read the INSTALL file.    *
    ********************************************************************

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-qcLrwN/pygtk/

Furthermore I have seen the following questions:

But still No light in my path

Edid 1:

I typed these command lines on my terminal:

mkvirtualenv pygtkexample --system-site-packages
workon pygtkexample
sudo apt-get install libgtk-3-dev
pip install pygtk

And I still get the very same error.

Upvotes: 0

Views: 521

Answers (2)

Dimitrios Desyllas
Dimitrios Desyllas

Reputation: 10032

Created a Virtualenv without the --system-site-packages. Just set the PYTHON_PATH enviromental variable to the value:

export PYTHON_PATH=$VIRTUAL_ENV/bin/python

Afterwards install:

pip install vext.pygtk

Then via the command

pip freeze > requirements.txt

you can put it into system's requirements.

Upvotes: 0

Uvar
Uvar

Reputation: 3462

Well..as the error tells you, you cannot build PyGTK this way in Linux.

you can create your environment with virtualenv --system-site-packages and then install other packages you want to use in this specific environment with pip install --ignore-installed, because these will locally be prioritized over the system-wide packages.

Alternatively, you can manually clone from git and build GTK.

In case you are using virtualenvwrapper type:

mkvirtualenv ^env_name^ --system-site-packages

As workaround, you can try to forego installing GTK in your venv, by using something along the lines of the following to import the system-wide package manually:

import sys
sys.path.append("/usr/lib/python2.7/dist-packages/gtk")

Upvotes: 1

Related Questions