Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Wrong python selected after select interpreter #25061

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

Closed
lorenzomammana opened this issue May 13, 2025 · 4 comments
Closed

Wrong python selected after select interpreter #25061

lorenzomammana opened this issue May 13, 2025 · 4 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@lorenzomammana
Copy link

Does this issue occur when all extensions are disabled?: Yes, partially I'm using remote development so I can't really disable that extension, this issue does not seem to arise when running in a wsl.

  • VS Code Version: 1.100.0
  • OS Version: Ubuntu 22.04.5 LTS (docker container)

Steps to Reproduce:

  1. Attach to a remote container
  2. Setup an environment (we use conda, e.g. conda create -n test python=3.10)
  3. Select interpreter -> Select the new environment

  4. which python -> To us it shows /opt/conda/bin/python, which is not the one used for the environment, the environment still looks activated, there's (test) before the username
  5. Run conda activate test manually
  6. which python -> $HOME/.conda/envs/test/bin/python, this is the what happend using vscode < 1.100.0

This is quite problematic as it seems that an environment is active when it's not causing missing dependencies etc..

@karthiknadig karthiknadig transferred this issue from microsoft/vscode May 13, 2025
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label May 13, 2025
@karthiknadig
Copy link
Member

@lorenzomammana Can you share your logs from Output > Python?

@github-actions github-actions bot added the info-needed Issue requires more information from poster label May 13, 2025
@lorenzomammana
Copy link
Author

lorenzomammana commented May 14, 2025

@karthiknadig
I've opened a repository called quadra, with an active environment called quadra.
From the log it seems that pyhton interpreter path is correct, but when running which python it still points to /opt/conda/bin/python

2025-05-14 09:12:25.469 [info] Experiment 'pythonRecommendTensorboardExt' is active
2025-05-14 09:12:25.469 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2025-05-14 09:12:25.469 [warning] Dir "/home/lorenzo.mammana/quadra/.pixi/envs" is not watchable (directory does not exist)
2025-05-14 09:12:25.703 [info] Python interpreter path: ~/.conda/envs/quadra/bin/python
2025-05-14 09:12:28.411 [info] > pyenv which python
2025-05-14 09:12:28.411 [info] cwd: .
2025-05-14 09:12:29.479 [info] > conda info --json
2025-05-14 09:12:29.479 [info] shell: bash
2025-05-14 09:12:30.340 [info] > conda run -p ~/.conda/envs/quadra --no-capture-output python ~/.vscode-server/extensions/ms-python.python-2025.6.0-linux-x64/python_files/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2025.6.0-linux-x64/python_files/printEnvVariables.py
2025-05-14 09:12:30.340 [info] shell: bash
2025-05-14 09:12:30.957 [info] > /bin/python3 ~/.vscode-server/extensions/ms-python.python-2025.6.0-linux-x64/python_files/printEnvVariables.py
2025-05-14 09:12:30.957 [info] shell: bash
2025-05-14 09:12:31.017 [info] Setting environment variable TORCH_DISTRIBUTED_DEBUG in collection to INFO {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable DOCKER_REGISTRY_PASSWORD in collection to [REDACTED]{"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable CONDA_ROOT in collection to /opt/conda {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable CONDA_PREFIX in collection to /home/lorenzo.mammana/.conda/envs/quadra {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable MLFLOW_S3_ENDPOINT_URL in collection to http://192.168.3.78:9100 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable QUADRA_SEARCH_PATH in collection to pkg://graffa.configs {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable MLFLOW_TRACKING_URI in collection to http://192.168.3.78:5100 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable CONDA_PROMPT_MODIFIER in collection to (quadra)  {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable AWS_SECRET_ACCESS_KEY in collection to [REDACTED]{"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable CONFLUENCE_USERNAME in collection to [REDACTED]{"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable CONFLUENCE_URL in collection to [REDACTED]{"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable HYDRA_FULL_ERROR in collection to 1 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable DOCKER_REGISTRY_USERNAME in collection to [REDACTED]{"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable CONDA_SHLVL in collection to 2 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable AWS_ACCESS_KEY_ID in collection to [REDACTED]{"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable CONFLUENCE_PASSWORD in collection to [REDACTED] {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.017 [info] Setting environment variable CONDA_DEFAULT_ENV in collection to quadra {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.018 [info] Prepending environment variable PATH in collection to /home/lorenzo.mammana/.vscode-server/bin/19e0f9e681ecb8e5c09d8784acaa601316ca4571/bin/remote-cli:/home/lorenzo.mammana/.local/bin:/home/lorenzo.mammana/bin:/home/lorenzo.mammana/.cargo/bin:/home/lorenzo.mammana/google-cloud-sdk/bin:/home/lorenzo.mammana/.conda/envs/quadra/bin:/opt/conda/condabin:/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/cuda/bin:/home/lorenzo.mammana/.dotnet/tools: {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.018 [info] Setting environment variable CONDA_PREFIX_1 in collection to /opt/conda {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-14 09:12:31.018 [info] Prepending environment variable PS1 in collection with (quadra)  {"applyAtShellIntegration":true,"applyAtProcessCreation":false}
2025-05-14 09:12:31.018 [info] Send text to terminal: /bin/python3 /home/lorenzo.mammana/.vscode-server/extensions/ms-python.python-2025.6.0-linux-x64/python_files/printEnvVariablesToFile.py /home/lorenzo.mammana/.vscode-server/extensions/ms-python.python-2025.6.0-linux-x64/python_files/deactivate/bash/envVars.txt
2025-05-14 09:12:31.478 [info] Starting Pylance language server.
2025-05-14 09:12:31.631 [info] > conda info --json

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label May 14, 2025
@karthiknadig
Copy link
Member

@lorenzomammana Can you try adding this to your User settings, reload VS Code and see if it helps.

    "python.experiments.optOutFrom": ["pythonTerminalEnvVarActivation"]

@github-actions github-actions bot added the info-needed Issue requires more information from poster label May 14, 2025
@lorenzomammana
Copy link
Author

This does seem to work!

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label May 15, 2025
@karthiknadig karthiknadig closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2025
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

3 participants