17

For some reason, I can't open the terminal through the shortcut (terminal icon) in Ubuntu 22.04. It works through Visual Studio Code, though, so that makes me confused. I tried using the F keys, but they are only working to the fn functions (such as controlling the brightness). I am not very knowledgeable on how Ubuntu works, so I am terribly confused.

I did try (unsuccesfully) to change my python version to 3.11.

Edit: The contents of /usr/share/applications/org.gnome.Terminal.desktop:

[Desktop Entry]
Name=Terminal
Comment=Use the command line
Keywords=shell;prompt;command;commandline;cmd;
TryExec=gnome-terminal
Exec=gnome-terminal
Icon=org.gnome.Terminal
Type=Application
Categories=GNOME;GTK;System;TerminalEmulator;
StartupNotify=true
StartupWMClass=Gnome-terminal
X-GNOME-SingleWindow=false
OnlyShowIn=GNOME;Unity;
Actions=new-window;preferences;
X-Ubuntu-Gettext-Domain=gnome-terminal

[Desktop Action new-window]
Name=New Window
Exec=gnome-terminal --window

[Desktop Action preferences]
Name=Preferences
Exec=gnome-terminal --preferences
6
  • 2
    By any chance, did you change the default python version? Nov 28, 2022 at 23:04
  • 1
    oh, I mistook 'python' for 'linux'. I did try (unsuccesfully) to change my python version to 3.11;
    – user480840
    Nov 28, 2022 at 23:13
  • 1
    @ArchismanPanigrahi, do you know what the problem could be, given the new information?
    – user480840
    Nov 29, 2022 at 20:10
  • 3
    Changing the default python version is bound to cause a lot of problems, for example see askubuntu.com/questions/1223013/…. If the already posted answer does not work for you, you will probably have to reinstall Ubuntu Nov 29, 2022 at 23:55
  • 1
    You should be able to open xterm. It's hideous by default but you should be able to make any changes you need.
    – MDeBusk
    Nov 30, 2022 at 2:05

6 Answers 6

21
+50

If you try to change your python version in a linux distro, it will most certainly cripple your environment. Python is an integral part and may not be changed under any circumstances. There are many questions & answers about it in this forum.

What could you do?

Depending on how you installed it, try to remove every remnant of your python 3.11.x and install the origin python from the repos.

Since you cannot open terminal, open a virtual terminal with ctrl + alt + f3 and login with your username and password.

If your "orignal" version was not removed, you may tell the system to use it again:

sudo update-alternatives --config python3

Select the Version 3.10.6, if provided.

If the alternatives group was removed, that will not work. Try this command:

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
sudo update-alternatives --config python3

If all else fails you may need to reinstall Ubuntu.

What if you need another python version?

There are many possible ways to install any python version in a special environment like "pipenv", "anaconda", "venv", you name it. See here for a small overview of virtual environments.

The current python version in Ubuntu 22.04 ist 3.10.6 as of today.

4
  • 7
    I changed it back to python 3.10 and it worked! thanks!
    – user480840
    Nov 30, 2022 at 16:52
  • 1
    works! thank you!
    – Zion
    Aug 29, 2023 at 17:19
  • 4
    Fro me I have to use this command first sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 and then run sudo update-alternatives --config python3 Jan 12 at 8:01
  • 1
    @JinoAntony has the best solution in case the entire group was removed.
    – Tony
    Mar 24 at 23:36
7

Had a similar issue, a youtube video resolved my case, without using any cmd line. Go to settings -> Language&Settings -> Change English (United States) to English (Canada) then restart.

5
  • 1
    I change languages as this comment, restart and it work
    – Tung Vo
    Sep 10, 2023 at 2:52
  • I was able to solve the problem for me with Inno's Answer. After switching to "English (Canada)" I was able to switch back to "English (United States)" with the same procedure and it still works. Oct 27, 2023 at 22:09
  • I actually just did a simple reboot and it fixed it too. Curious to hear if there are any reasons why the language change should have any effect here.
    – Niko Fohr
    Dec 8, 2023 at 6:57
  • 1
    works with my case (in a VBox virtual machine)
    – Xavier Z.
    Apr 11 at 2:55
  • Worked for me too. It's annoying that freshly installed ubuntu have this bug. Apr 17 at 15:08
0

For me it was Default Locales.

nano /etc/default/locales

Remove lines that have "LC" or just delete all lines. Reboot.

0

I had to update my locale settings in ubuntu:

sudo update-locale LANG=de_DE.UTF-8 LC_MESSAGES=POSIX

Maybe you have to renew your locales or set it to your country.

0

I had the same issue after my auto-update re-installed memory-hog useless Snap again. I've never used evil Snap, and I've purged it from my system many times.

Also the same update made changes in the Settings > Region & Languages > Language => UNSPECIFIED.

That is the root of the problem! Thanks to Inno. (the auto-update has also changed Python version too :)

The solution was simple and obvious: set my language - English(US) and restart.

All my time-wasting attempts to sudo apt install --reinstall gnome-terminal and set Python version were unsuccessful.

-1

I had a similar issue. I tried a bunch of things everywhere. Here's what I eventually found that worked. It turned out when I updated python, it updated what gnome-terminal was set to. Here's what ya do:

Ctrl + Alt + F3, this will open a terminal

login

type sudo vim /usr/bin/gnome-terminal substitute vim for whatever editor you have if needed

check the comment at the top does it read #!/usr/bin/python3? If so, change it to the version you're using of python.

I was updating to 3.9 so I changed it to #!/usr/bin/python3.9. This fixed the issue and allowed me to open the terminal.

The issue was caused by when I updated python, for some reason it changed the gnome-terminal to just generically be python, instead of the python version I was actually using.

1
  • generic "python3" is symlinked to the system version of Python. Updating your version of Python messed with that, not with the shebang in gnome terminal. Something is still very broken with your system if the programs that are included in the OS can't run using the default python. Follow the other answer here to fix it.
    – Esther
    Apr 20, 2023 at 17:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .