Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual environment from a previous workspace activated in a new workspace that I opened #23352

Open
qubitron opened this issue May 7, 2024 · 5 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@qubitron
Copy link

qubitron commented May 7, 2024

Behaviour

The virtual environment of a previous workspace I'm using appears to have somehow been set as the defaultPythonInterpreter

Steps to reproduce:

  1. From the command line, create folder1 and inside of it a virtual environment in it.
  2. Open VS code (code .) in that folder and create a basic "helloworld.py" python script
  3. Now create folder2, and then open vs code (code .) in that folder with a basic helloworld.py

image

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2024-05-06 14:23:23.876 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-05-06 14:23:23.876 [info] Experiment 'pythonREPLSmartSend' is active
2024-05-06 14:23:23.876 [info] Experiment 'pythonSurveyNotificationcf' is active
2024-05-06 14:23:23.876 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-05-06 14:23:23.876 [info] Experiment 'pythonTestAdapter' is active
2024-05-06 14:23:23.876 [info] Default formatter is set to null for workspace c:\dev\bugbash\hubs-and-projects-bugbash
2024-05-06 14:23:23.876 [info] > hatch env show --json
2024-05-06 14:23:23.876 [info] cwd: .
2024-05-06 14:23:23.876 [info] Python interpreter path: c:\dev\promptflow\.venv\Scripts\python.exe
2024-05-06 14:23:23.911 [info] > conda info --json
2024-05-06 14:23:23.981 [info] > c:\dev\promptflow\.venv\Scripts\python.exe -I ~\.vscode\extensions\ms-python.python-2024.6.0\python_files\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2024.6.0\python_files\interpreterInfo.py
2024-05-06 14:23:24.226 [info] > pyenv which python
2024-05-06 14:23:24.226 [info] cwd: .
2024-05-06 14:23:24.370 [info] > c:/dev/promptflow/.venv/Scripts/activate.bat && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.6.0/python_files/printEnvVariables.py
2024-05-06 14:23:24.370 [info] shell: commandPrompt
2024-05-06 14:23:24.743 [info] > ~\AppData\Local\Programs\Python\Python312\python.exe ~/.vscode/extensions/ms-python.python-2024.6.0/python_files/printEnvVariables.py
2024-05-06 14:23:24.743 [info] shell: commandPrompt
2024-05-06 14:23:24.851 [info] Prepending environment variable PATH in collection with c:\dev\promptflow\.venv\Scripts; {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-05-06 14:23:24.851 [info] Setting environment variable PROMPT in collection to (.venv) $P$G {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-05-06 14:23:24.851 [info] Setting environment variable VIRTUAL_ENV in collection to c:\dev\promptflow\.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-05-06 14:23:24.851 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to (.venv)  {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-05-06 14:23:24.851 [info] Setting environment variable _OLD_VIRTUAL_PROMPT in collection to $P$G {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-05-06 14:23:25.561 [info] Starting Pylance language server.
2024-05-06 14:33:14.732 [info] > ~\AppData\Local\Programs\Python\Python312\python.exe -I ~\.vscode\extensions\ms-python.python-2024.6.0\python_files\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2024.6.0\python_files\interpreterInfo.py
2024-05-06 14:33:42.525 [info] > .\.venv\Scripts\python.exe -I ~\.vscode\extensions\ms-python.python-2024.6.0\python_files\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2024.6.0\python_files\interpreterInfo.py
2024-05-06 14:33:49.273 [info] Discover tests for workspace name: hubs-and-projects-bugbash - uri: c:\dev\bugbash\hubs-and-projects-bugbash
2024-05-06 14:33:49.275 [info] Python interpreter path: .\.venv\Scripts\python.exe
2024-05-06 14:33:50.339 [info] Prepending environment variable PATH in collection with c:\dev\bugbash\hubs-and-projects-bugbash\.venv\Scripts; {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-05-06 15:14:15.564 [info] Discover tests for workspace name: hubs-and-projects-bugbash - uri: c:\dev\bugbash\hubs-and-projects-bugbash\create_hub_and_project.py
2024-05-06 15:27:52.650 [info] Discover tests for workspace name: hubs-and-projects-bugbash - uri: c:\dev\bugbash\hubs-and-projects-bugbash\create_hub_and_project.py
2024-05-06 15:30:58.959 [info] Discover tests for workspace name: hubs-and-projects-bugbash - uri: c:\dev\bugbash\hubs-and-projects-bugbash\create_hub_and_project.py
2024-05-06 15:34:36.006 [info] Discover tests for workspace name: hubs-and-projects-bugbash - uri: c:\dev\bugbash\hubs-and-projects-bugbash\create_hub_and_project.py
2024-05-06 15:37:02.606 [info] Discover tests for workspace name: hubs-and-projects-bugbash - uri: c:\dev\bugbash\hubs-and-projects-bugbash\create_hub_and_project.py
2024-05-06 15:51:31.032 [info] Discover tests for workspace name: hubs-and-projects-bugbash - uri: c:\dev\bugbash\hubs-and-projects-bugbash\example-hub-and-project-manipulation.py
2024-05-06 15:53:39.131 [info] Discover tests for workspace name: hubs-and-projects-bugbash - uri: c:\dev\bugbash\hubs-and-projects-bugbash\create_hub_and_project.py
2024-05-06 15:53:53.140 [info] Discover tests for workspace name: hubs-and-projects-bugbash - uri: c:\dev\bugbash\hubs-and-projects-bugbash\create_hub_and_project.py
2024-05-06 16:03:30.288 [info] > .\.venv\Scripts\python.exe -I ~\.vscode\extensions\ms-python.python-2024.6.0\python_files\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2024.6.0\python_files\interpreterInfo.py
2024-05-06 16:03:31.097 [info] > .\.venv\Scripts\python.exe -I ~\.vscode\extensions\ms-python.python-2024.6.0\python_files\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2024.6.0\python_files\interpreterInfo.py

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label May 7, 2024
@luabud
Copy link
Member

luabud commented May 7, 2024

I can also repro this. I was expecting a global interpreter to be selected by default 🤔
cc @anthonykim1 @karthiknadig

@debonte
Copy link

debonte commented May 7, 2024

I'm also seeing this. When I go to select a different interpreter, the one I expected to be auto-selected is marked as "Recommended", which I found strange. If that's the recommended one, it should have been selected?

image

@sveinse
Copy link

sveinse commented May 16, 2024

I see the same thing. I use an individual venv per project. If I open two projects at the same time (in two VS Code windows) that each have their own venv/ directory. When I open a new terminal, I get a message that the the venv has been activated. However it incorrectly activates the venv for the project that opened first. In both projects.

It not immediately easy to detect the error as it seems a proper venv has been loaded. But it creates a lot of confusion as pip install will go other places than expected.

@debonte
Copy link

debonte commented May 16, 2024

If I open two projects at the same time...

I suspect that that is how I was reproing this also.

@sveinse
Copy link

sveinse commented May 22, 2024

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

5 participants