0

The authentication window pops-up but then I'm getting a bunch of errors (in the console) and nothing happens. Looked up similar issues on the Internet and tried the following:

  • updating the OS
  • installing: python-gobject, python-gi, dev-tools

Thanks in advance for any advice.

Traceback (most recent call last):
  File "/usr/share/gufw/gufw/gufw.py", line 21, in 
    from gufw.view.gufw  import Gufw
  File "/usr/share/gufw/gufw/gufw/view/gufw.py", line 18, in 
    import gi
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in 
    from . import _gi
ImportError: cannot import name '_gi'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in 
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in 
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in 
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in 
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in 
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/share/gufw/gufw/gufw.py", line 21, in 
    from gufw.view.gufw  import Gufw
  File "/usr/share/gufw/gufw/gufw/view/gufw.py", line 18, in 
    import gi
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in 
    from . import _gi
ImportError: cannot import name '_gi'
  • ModuleNotFoundError: No module named 'apt_pkg' says install the apt_pkg module. – waltinator Sep 19 '17 at 22:11
  • 1
    @waltinator could you provide more details. – Panther Sep 20 '17 at 3:00
0

Not sure what, if anything you might have done to cause this. Upgrade Ubuntu? How did you install UFW? From the repos?

At any rate , that is sort of a non-specific error and might occur with other packages as well.

As a first step try updating (“dist-upgrade”) to see if you have outdated or held packages.

sudo apt-get update
sudo apt-get dist-upgrade -f

If that fails as a second step try re-installing python-apt

See https://packages.ubuntu.com/zesty/python-apt

sudo apt-get install --reinstall python-apt

You could shorten those two commands, but I hope it is more clear to demonstrate the reinstallation of python-apt.

  • I've installed GUFW simply with: sudo apt-get install gufw unfortunately none of the steps you provided solved the problem. Upgrading Ubuntu had no effect either. What helped was a complete reinstall of the system. My guess is I must have messed something up with the default python. Thanks for looking into this – Maddak Sep 20 '17 at 19:36
0

I've encountered the same problem, and it's really not easy to find a good fix (they're really very few results on google), so my solution is to fully reinstall pygobject in accordance with https://pygobject.readthedocs.io/en/latest/getting_started.html

sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0  
sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0  
pip3 install pycairo  
pip3 install PyGObject

(You need to apt install python3-pip beforehand.)

It worked perfectly for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.