-1

At some point the software updater vanished from the system. Now I reinstalled this package

sudo apt-get install update-manager

but when I try to call it with

sudo /usr/bin/update-manager

I get an error

Traceback (most recent call last):
  File "/usr/bin/update-manager", line 28, in <module>
    from gi.repository import Gtk
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
    from . import _gi
ImportError: cannot import name '_gi'

Any idea how to fix this issue?

Additional information:

~$ python -V
Python 3.6.8
~$ python2 -V
Python 2.7.12

The problem seems to be connected that I changed the default python to python3. But I want to keep python3 as the default python.

  • 1
    Most likely you removed python2 or did something else with python. – Pilot6 Sep 30 at 11:49
  • 1
    If you remove python 2 from Ubuntu, lots of things stop working. – Pilot6 Sep 30 at 11:50
  • 1
    Possible duplicate of Is it safe to remove python2 in ubuntu 18.04 LTS – Pilot6 Sep 30 at 11:51
  • 1
    python should report 2.x; python3 should report 3.x. All system tools that use python (2.x) will no longer work - which include package tools. It has everything to do with your question. dpkg will still work though (just not apt tools). Your fix is to undo what you did, restore python to run 2.x, and python3 run python 3.x – guiverc Sep 30 at 11:56
  • 2
    You fix it this way. askubuntu.com/a/802144/167850 It doesn't remove python2, it makes it default back. /usr/bin/python is a link. – Pilot6 Sep 30 at 12:01
3

There is no way to keep python3 as default on Ubuntu 16.04, because many programs including apt are written in python2.

And there is absolutely no need to set python3 as default as you can run python3 apps using python3 appname or setting python3 in shebang.

You can set back default to python2 by running:

sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.7 /usr/bin/python

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.