2

I have updated my computer from Ubuntu 18.04 to 20.04. During the update, may be I accidentally deleted some file when some pop-up appeared. I accepted this ubuntu ask to replace config file. And chose remove ubuntu ask for remove obsolete package I looked at the list of the file but it's too strange and the OS tells me that they are old.

When I am on the new OS, I cannot open terminal by clicking the icon or using Ctrl+Alt+T. I can only open it by clicking 'open in terminal' in nautilus. I tried opening terminal by typing gnome-terminal but there's an error:

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

I searched and found this topic on askubuntu. I followed the accepted answer but that didn't help. I also tried the second best answer and the result is the same. I think its because I am missing those _gi.cpython-35m-x86_64-linux-gnu.so and _gi_cairo.cpython-35m-x86_64-linux-gnu.so files. I have already installed python3.6 and python3.5 ?

Someone in the comment suggests that apt_pkg is missing. And I ran sudo apt-get update to check and found an error message: ImportError: No module named 'apt_pkg'.

Again I started searching on askubuntu. I tried some solutions and realized the folder /usr/lib/python3/dist-packages/gi/ contains only _gi_cairo.cpython-38-x86_64-linux-gnu.so and _gi_cairo.cpython-38-x86_64-linux-gnu.so files. So I coppied it into apt_pkg. Now, the error from apt-get update is resolved, however I still cannot open terminal in both the earlier methods I described.

I have tried every solution I can find on stackoverflow but it still won't help. The last solution I can think of is reinstalling the OS. Thanks in advance for any help.

Abhay Patil
  • 2,705
H.Phuc
  • 21
  • If you happened to remember anything useful about the "some file" you deleted, it would be much easier to help. – user535733 Apr 28 '20 at 14:45
  • Sorry, I'm only too eager to upgrade. I have add 2 images' link but because I'm new to ask ubuntu, I can't post image. – H.Phuc Apr 28 '20 at 15:26
  • 1
    Reviewers: OP stated in a comment on the answer that they reinstalled... – guntbert Aug 21 '20 at 20:32

1 Answers1

0

I had the same issue and error message with 20.04. I traced it to the python version. The 20.04 upgrade installs python 3.8. I needed python 3.7 as well and had set update-alternatives to 3.7. Setting back to 3.8 fixed this issue.

Not sure if that helps here.

Appy64
  • 1
  • I just reinstalled my ubuntu a few minutes ago. ANW, thanks for the solution, hope this's helpful to others. – H.Phuc May 30 '20 at 04:36