0

I have an Ubuntu 18.LTS and accidentally triggered

update-alternatives --config python3.6

That seems to have broken my system since now neither terminal, terminator and apt seems to be not working

Terminator

Traceback (most recent call last):
  File "/usr/bin/terminator", line 23, in <module>
    import psutil
ModuleNotFoundError: No module named 'psutil'

Terminal

Traceback (most recent call last):
  File "/usr/bin/gnome-terminal", line 9, in <module>
    from gi.repository import GLib, Gio
ModuleNotFoundError: No module named 'gi'

apt

Trying for instance to add repository (just trying to install 3.5 as it seems to be the default used for all this programs)

 internetmosquito@internetmosquito-PE72-7RD  ~  sudo add-apt-repository ppa:deadsnakes/ppa
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 12, in <module>
    from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
ModuleNotFoundError: No module named 'softwareproperties'

Now, I must say I have different versions of Python that I have installed with pyenv:

 ✘ internetmosquito@internetmosquito-PE72-7RD  ~  pyenv versions
  system
  2.7.13
* 3.8.3 (set by /home/internetmosquito/.pyenv/version)
  3.9-dev

Most of those are installed in /home/internetmosquito/.pyenv/versions

 internetmosquito@internetmosquito-PE72-7RD  ~  ls -ltra /home/internetmosquito/.pyenv/versions
total 20
drwxr-xr-x  6 internetmosquito internetmosquito 4096 jun 13  2020 3.9-dev
drwxr-xr-x  6 internetmosquito internetmosquito 4096 jun 16  2020 3.8.3
drwxrwxr-x 13 internetmosquito internetmosquito 4096 sep 27 20:35 ..
drwxr-xr-x  6 internetmosquito internetmosquito 4096 feb  9 01:05 2.7.13
drwxr-xr-x  5 internetmosquito internetmosquito 4096 feb  9 02:12 .

Now if I check /usr/bin/python I see the following

internetmosquito@internetmosquito-PE72-7RD  ~  ls -ltra /usr/bin/python*
lrwxrwxrwx 1 root root      16 mar 13  2020 /usr/bin/python3-config -> python3.8-config
lrwxrwxrwx 1 root root       9 mar 13  2020 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root     388 mar 28  2020 /usr/bin/python3-pasteurize
-rwxr-xr-x 1 root root     384 mar 28  2020 /usr/bin/python3-futurize
-rwxr-xr-x 1 root root     152 abr  9  2020 /usr/bin/python3-pbr
lrwxrwxrwx 1 root root      33 jul 28  2020 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config
-rwxr-xr-x 1 root root 5486352 jul 28  2020 /usr/bin/python3.8
-rwxr-xr-x 1 root root 3629032 ago  4  2020 /usr/bin/python2.7
lrwxrwxrwx 1 root root      25 feb  8 23:49 /usr/bin/python3 -> /etc/alternatives/python3
lrwxrwxrwx 1 root root      24 feb  9 00:50 /usr/bin/python -> /etc/alternatives/python

Seems I don't have a Python 3.5 which "I think" is what terminator uses...

 internetmosquito@internetmosquito-PE72-7RD  ~  cat /usr/bin/terminator 
#!/usr/bin/python3

And my python3 resolves to actually the same as my python...

internetmosquito@internetmosquito-PE72-7RD  ~  python
Python 3.8.3 (default, Jun 16 2020, 18:30:59) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
 internetmosquito@internetmosquito-PE72-7RD  ~  python3
Python 3.8.3 (default, Jun 16 2020, 18:30:59) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

If I try to update-alternatives again, I get this message...

internetmosquito@internetmosquito-PE72-7RD  ~  sudo update-alternatives --config python3 There is only one alternative in link group python3 (providing /usr/bin/python3): /usr/local/bin/python3.7 Nothing to configure.

Not even sure why it mentions python3.7 there? I do see though several pythons in /usr/local/bin

✘ internetmosquito@internetmosquito-PE72-7RD  ~  ls -ltra /usr/local/bin/python*
lrwxrwxrwx 1 root root       17 dic 24  2018 /usr/local/bin/python3.7-config -> python3.7m-config
-rwxr-xr-x 2 root root 14925232 dic 24  2018 /usr/local/bin/python3.7m
-rwxr-xr-x 2 root root 14925232 dic 24  2018 /usr/local/bin/python3.7
-rwxr-xr-x 1 root root     3097 dic 24  2018 /usr/local/bin/python3.7m-config
-rwxr-xr-x 2 root root 14642520 feb  9 00:46 /usr/local/bin/python3.5m
-rwxr-xr-x 2 root root 14642520 feb  9 00:46 /usr/local/bin/python3.5
-rwxr-xr-x 1 root root     3071 feb  9 00:46 /usr/local/bin/python3.5m-config
lrwxrwxrwx 1 root root       17 feb  9 00:46 /usr/local/bin/python3.5-config -> python3.5m-config
lrwxrwxrwx 1 root root        9 feb  9 00:46 /usr/local/bin/python3 -> python3.5
lrwxrwxrwx 1 root root       16 feb  9 00:46 /usr/local/bin/python3-config -> python3.5-config

On top of this lsb_release does not work either!

 internetmosquito@internetmosquito-PE72-7RD  ~  lsb_release -a                 
Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 25, in <module>
    import lsb_release
ModuleNotFoundError: No module named 'lsb_release'

Don't even know how many other stuff is broken...any suggestions on getting back to normal that don't imply having to re-install Ubuntu? I tried this but didn't work..same issues as described above

Thanks!

4
  • See the error message says /usr/bin/, but you check in /usr/local/bin. Can you also add the output of ls -ltra /usr/bin/python* ?
    – pLumo
    Feb 9, 2021 at 17:07
  • 1
    @pLumo check above, I already posted the results of ls -ltra /usr/bin/python* Feb 9, 2021 at 17:25
  • sorry, i must have overlooked that
    – pLumo
    Feb 9, 2021 at 17:57
  • Try askubuntu.com/a/802144/631600
    – pLumo
    Feb 9, 2021 at 17:58

0

You must log in to answer this question.

Browse other questions tagged .