I activated the virtual environment of my project via the terminal and then opened the project path in VSCodium. However, VSCodium fails to find the interpreter of the virtual environment when I try to choose a kernel. It looks like the directory in the output is somehow wrong.
Error output:
[warning] Failed to check if /home/user/code_projects/gps_data_2107/venv is an executable [Error: ENOENT: no such file or directory, lstat '/home/ben/code_projects/gps_data_2107/venv'] {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: '/home/user/code_projects/gps_data_2107/venv'
}
[warning] Identifier for virt-virtualenv failed to identify /home/ben/code_projects/gps_data_2107/venv [Error: ENOENT: no such file or directory, scandir '/home/user/code_projects/gps_data_2107'] {
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '/home/user/code_projects/gps_data_2107'
}
Additional Information:
- VSCodium Version: 1.91.1 (release: 24193)
- Python Version: 3.12.3
- Operating System: Ubuntu 24.04 LTS
- Activate the virtual environment via the terminal:
source /home/user/code_projects/gps_data_2107/venv/bin/activate
- Open the project path in VSCodium:
cd /home/user/code_projects/gps_data_2107 vscodium .
- Try to select the interpreter for the virtual environment.
bn@ros2:~$ cd Code/gps_data_2207/
bn@ros2:~/Code/gps_data_2207$ source venv/bin/activate
(venv) bn@ros2:~/Code/gps_data_2207$ which python
(venv) bn@ros2:~/Code/gps_data_2207$ which python3
/usr/bin/python3
Expected Behavior: VSCodium should correctly detect and use the interpreter from the activated virtual environment.
Actual Behavior: VSCodium fails to detect the virtual environment interpreter and outputs the error messages as shown above.
2
Answers
I think I might have solved it. The name of the original project folder (which contains the environment folder) was changed. When I renamed it back to the original name, I got the following terminal output:
try to execute
which python
once you activate the venv and vscodium, if it’s not detecting the correct one, then you need to activate the venv after the vscodium