How do I get VSCodium to use the same shell/environment as the rest of my system?

I realize my problem is with a specific app but I do not have, or have not noticed, this problem when using VSCodium on other distributions in the past, or while using the VSC snap package in an Ubuntu VM. So I apologize for posting here but this configuration seems to me to be specific to the Fedora/Flatpak package of VSCodium. I thought maybe another more experienced VSCodium user might be able to help me with this. I’m just a regular guy learning to code with Python in my spare time so please forgive my inexperience.

I discovered this problem when I tried to run a Python program I wrote in VSC’s integrated terminal. I get hit with an error that the module I’m trying to import (pygame) is not installed, even though I know the module is installed. Running pip show pygame in Gnome Terminal confirms this. That’s when I noticed that the prompt in VSC’s integrated terminal is different to the regular Gnome Terminal.

In VSC the prompt shows as sh-5.1$, while the Terminal app has my familiar [dennis@fedora ~]$. Checking the version of bash and python in both confirms that I’m working with two different environments here. Using pip to install the module within VSC’s terminal does “fix” the problem, but I find it very redundant to install the same module twice!

I’ve poked around VSC’s settings looking for terminal, shell, environment options; I’ve turned a few things on and off but I can’t find the fix.

VSCodium version: 1.76.2.23074

Bash/Python versions in VSCodium:

sh-5.1$ bash --version
GNU bash, version 5.1.16(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
sh-5.1$ python --version
Python 3.10.6

Bash/Python version according to Gnome Terminal:

[dennis@fedora ~]$ bash --version
GNU bash, version 5.2.15(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[dennis@fedora ~]$ python --version
Python 3.11.2
[dennis@fedora ~]$ which python
/usr/bin/python

I tried to explicitly set the interpreter, but the version I want, accessible from any other terminal, does not show up on the list:

image

You can see the selected interpreter is /usr/bin/python, which is the same path from the which python command above.

I’m at a loss here. I’m not sure how this is even possible. I can’t even import tkinter with whatever interpreter VSCodium is using, even though that’s a standard library module.

I’ve also tried right-clicking the file in the explorer and selecting “run in external terminal”. According the my settings, this should open Gnome Terminal, but it does nothing instead. Is this a side-effect of VSC being installed with a flatpak?

1 Like

Might be helpful to get the output of echo $SHELL from here so you can see which bash on your system it is running.

It is definitely possible that it is using a python and bash bundled in the flatpak instead of your system binaries. It’s possible to allow access to these system paths via flatseal. Keep in mind that you definitely do not want to run pip as root/sudo in that environment if you do this, as you might end up clobbering dnf installed python libraries.

image

System:

[dennis@fedora ~]$ echo $SHELL
/bin/bash

VSCodium:

bash-5.1$ echo $SHELL
/bin/sh

I will look into flatseal when I have some more time later.

Yup, you’re definitely using the bundled environment from the flatpak then. On Fedora, /bin/sh is a symlink to bash.

$ ls -l /bin/sh
lrwxrwxrwx. 1 root root 4 Jan  2 03:47 /bin/sh -> bash

Hmm… I installed Flatseal and enabled all filesystem permissions. Even went to far as to explicitly add /usr/bin/python3.11.

My VSCode terminal now shows bash-5.11$ instead of sh-5.1 but I still can’t select the python interpreter I want. It doesn’t show up in the list, and explicitly pointing VSC to /usr/bin/python3.11 also doesn’t work. I get a bunch of error output that basically amounts to “file not found”.

I’m also still not able to launch the file in an external terminal emulator.

I think I will abandon the Flatpak for now. I just realized it’s not an official release from the VSCodium team. I wasn’t aware they had RPM available. I’ll give that a try, thanks for your help though! At least I learned that Flatseal is a thing! That’ll come in handy in the future.

1 Like

oh, I just wasted an hour thinking I’m doing something wrong…it is infuriating that can set up oh-my-posh on WINDOWS(!!!) but struggle with the same on Linux because flatpak… I guess I’ll just compile vss myself…(edit: actually…rpm worked…good enough)

I faced the same problem. I was working on openframeworks (a C++ creative coding api). The flatpak version of codium fails to compile every time because of its integrated terminal.

I got back the default terminal by installing the official version of codium from the official website. Go to the official website and follow the instructions to install the official version