VSCode switching multiple pipenv environments

Viewed 14

In my workplace we manage multiple python flask projects and all of them are configured in the VSCode workspace. Each of the projects are separate folders and each of them has .venv folder created under it. We had a windows system earlier with which i'm able to run an application in VSCode (which starts with the venv activate automatically), and when we stop that application and run another application (different project with different venv) it automatically changes the application folder path, exiting previous venv and activating the current one.

Recently we shifted to MAC and this particulat auto switching to different venv is not happening or not sure whether its happening. It stays in the same venv (as per $VIRTUAL_ENV and oh-my-posh prompt which always shows the current virtual env). But the status bar in the vscode shows the different venv like Project: Flask (venv)

Can someone help me to find which config needs to be done to get this properly. VSCode Launcher.json / settings.json / venv path in VSCode settings.

  1. pipenv --where shows the venv in current path, not the one which is activ
  2. pip -V shows current venv
  3. $VIRTUAL_ENV var is also showing current venv
  4. VSCode status bar debug configuration shows the app which ran last

Issue 1: How exactly we find out which venv is active (googling provides so much of options and all of the results differs with each one). Issue 2: How do i make sure the respective venv is activated when the app is executed. (please dont tell me to manually exit and activate each time before running app).

Thanks a lot for your efforts if you are reading till now.

0 Answers
Related