skip to Main Content

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

screenshot

  1. Activate the virtual environment via the terminal: source /home/user/code_projects/gps_data_2107/venv/bin/activate
  2. Open the project path in VSCodium: cd /home/user/code_projects/gps_data_2107 vscodium .
  3. 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


  1. Chosen as BEST ANSWER

    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:

    bn@ros2:~$ cd Code/gps_data/
    bn@ros2:~/Code/gps_data$ source venv/bin/activate
    (venv) bn@ros2:~/Code/gps_data$ which python3
    /home/user/Code/gps_data/venv/bin/python3
    

  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search