# ImportError: No module named gi



## tim-m89 (Jun 25, 2012)

Hi I am trying to run deluge but everytime I get the error: 
	
	



```
% deluge
/usr/local/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py:40: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
  from gtk import _gtk
ImportError: No module named gi
[ERROR   ] 20:58:45 ui:168 No module named gi
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/deluge-1.3.5-py2.7.egg/deluge/ui/ui.py", line 150, in __init__
    ui = GtkUI(args)
  File "/usr/local/lib/python2.7/site-packages/deluge-1.3.5-py2.7.egg/deluge/ui/gtkui/gtkui.py", line 229, in __init__
    self.menubar = MenuBar()
  File "/usr/local/lib/python2.7/site-packages/deluge-1.3.5-py2.7.egg/deluge/ui/gtkui/menubar.py", line 75, in __init__
    "menuitem_max_connections", "menuitem_upload_slots"):
ImportError: No module named gi
[ERROR   ] 20:58:45 ui:169 There was an error whilst launching the request UI: gtk
[ERROR   ] 20:58:45 ui:170 Look at the traceback above for more information.
```
 I have tried reinstalling devel/gobject-introspection, net-p2p/deluge and even running [cmd=]portmaster -d py27[/cmd] to get all the Python packages. py27-gobject has installed the correct files: 
	
	



```
ls -l /usr/local/lib/python2.7/site-packages/gi
total 214
-r--r--r--  1 root  wheel    2133 25 Jun 18:39 __init__.py
-rw-r--r--  1 root  wheel    1341 25 Jun 18:39 __init__.pyc
-rw-r--r--  1 root  wheel    1341 25 Jun 18:39 __init__.pyo
-rwxr-xr-x  1 root  wheel    1286 25 Jun 18:39 _gi.la
-rwxr-xr-x  1 root  wheel  117585 25 Jun 18:39 _gi.so
-rwxr-xr-x  1 root  wheel    1681 25 Jun 18:39 _gi_cairo.la
-rwxr-xr-x  1 root  wheel    8479 25 Jun 18:39 _gi_cairo.so
-r--r--r--  1 root  wheel    2373 25 Jun 18:39 importer.py
-rw-r--r--  1 root  wheel    1839 25 Jun 18:39 importer.pyc
-rw-r--r--  1 root  wheel    1839 25 Jun 18:39 importer.pyo
-r--r--r--  1 root  wheel   10930 25 Jun 18:39 module.py
-rw-r--r--  1 root  wheel    8953 25 Jun 18:39 module.pyc
-rw-r--r--  1 root  wheel    8888 25 Jun 18:39 module.pyo
drwxr-xr-x  2 root  wheel     512 25 Jun 18:39 overrides
drwxr-xr-x  2 root  wheel     512 25 Jun 18:39 repository
-r--r--r--  1 root  wheel   11465 25 Jun 18:39 types.py
-rw-r--r--  1 root  wheel    9083 25 Jun 18:39 types.pyc
-rw-r--r--  1 root  wheel    9034 25 Jun 18:39 types.pyo
```
Any ideas?


----------



## eadler@ (Jun 30, 2012)

See http://www.mail-archive.com/freebsd-python@freebsd.org/msg03089.html for a workaround.


----------



## tim-m89 (Jul 1, 2012)

Thanks a lot, that worked. Anyone else running into this issue, run this as root with the attached file:
[cmd=]patch /usr/local/lib/python2.7/site-packages/twisted/internet/gtk2reactor.py < twisted-fix.diff
[/cmd] [*]


----------

