You are not logged in.
This is one of the most stupidest thing I've ever done.
Recently for installing kivy I had to remove my site packages for both python 2.7 and python 3.4 in my Arch since installing kivy was aborted due to conflicts. During that time I also deleted a lot of other python files and directories. I removed both versions of python too.
I knew that reinstalling the whole thing would bring back things to normal, and to my luck most of it did. But recently I found that I cannot import gtk module. I tried installing pygtk via pip and using pacman and I still cant seem to import gtk. How can I bring back gtk ?
Last edited by mahesmohan (2015-07-29 09:10:52)
Offline
What command are you using to import the gtk module and in which python version? As far as I know pygtk is only for python2 and for python3 you should use the GObject Inspector module: https://python-gtk-3-tutorial.readthedo … le-example. However, what is the output of the following commands?
pacman -Qkk pygtk
python2 -c 'import sys; print("\n".join(sys.path))'
Offline
I noticed the issue when I tried running guake which used to work perfectly before the deletion, I tried running it from the CLI and got a Traceback with message
ImportError: No module named gtk
Here is the complete Traceback
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/site-packages/guake/main.py", line 28, in <module>
import gtk
ImportError: No module named gtk
I believe the traceback answers your question regarding the version of python and command used to import gtk module.
Here is the output of the commands you asked me to run:
pacman -Qkk pygtk
pygtk: 678 total files, 0 altered files
python2 -c 'import sys; print("\n".join(sys.path))'
/usr/lib/python27.zip
/usr/lib/python2.7
/usr/lib/python2.7/plat-linux2
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/lib/python2.7/site-packages
/usr/lib/python2.7/site-packages/gst-0.10
Offline
This is the output on my machine:
$ python2 -c 'import sys; print("\n".join(sys.path))'
/usr/lib/python27.zip
/usr/lib/python2.7
/usr/lib/python2.7/plat-linux2
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/home/daddona/.local/lib/python2.7/site-packages
/usr/lib/python2.7/site-packages
/usr/lib/python2.7/site-packages/gtk-2.0
As you can see, it seems that the gtk module search path is missing. The search path is specified in the file /usr/lib/python2.7/site-packages/pygtk.pth which is provided by the package python2-gobject2. Can you post the content of pygtk.pth and can you also check if python2-gobject2 package was altered?
Offline
Unfortunately there is no pygtk.pth was missing and I reinstalled python2-gobject2 package which fixed the issue of unable to import gtk module.
Thank you mauritiusdadd
Now running guake brings an error
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/site-packages/guake/main.py", line 28, in <module>
import gtk
File "/usr/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py", line 40, in <module>
from gtk import _gtk
ImportError: No module named cairo
Let me google and try to fix it, if not I'll be back right here
After reinstallation of a few packages gauke is up and running.
Last edited by mahesmohan (2015-07-29 09:10:14)
Offline
Offline
That's a new piece of information. Thanks again mauritiusdadd.
Offline