-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
Type: Bug
Behaviour
Python locator is insisting the python version in the .venv is in fact the previous version.
The .venv was removed, the environment was rebuilt with nix-shell, in a terminal outside of vscode everything works fine, even bin/pet resolve .venv/bin/python does the right thing, but inside vscode is not,
Steps to reproduce:
Uhm, good question, start a shell with nix-shell with the following shell.nix, and in vscode try and select the resulting .venv as your python interpreter. I'm not sure what else is involded, afaik it shouldn't see anything else....
# cSpell:words pkgs venv numpy
{ pkgs ? import <nixpkgs> {} }:
let
pythonPackages = pkgs.python312Packages;
in pkgs.mkShell {
name = "PyEnv-312";
venvDir = "./.venv";
buildInputs = with pkgs; [
pythonPackages.python
pythonPackages.venvShellHook
pythonPackages.setuptools
git
];
packages = [
(pkgs.python3.withPackages (python-pkgs: with python-pkgs; [
setuptools
# let octoprint setuptools manage these, they want specific versions
# json-rpc
# tornado
]))
];
sphinxHook = ''
sphinx-build -b html ./docs ./docs/_build
'';
# Run this command, only after creating the virtual environment
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install octoprint
pip install -r requirements.txt
'';
# Now we can execute any commands within the virtual environment.
# This is optional and can be left out to run pip manually.
postShellHook = ''
# allow pip to install wheels
unset SOURCE_DATE_EPOCH
'';
}Diagnostic data
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
2025-02-19 13:49:15.748 [info] Starting Python Locator /nix/store/63cr12ggsa70c6054ba9655hgrvivsb1-vscode-extension-ms-python-python-2025.1.2025021102/share/vscode/extensions/ms-python.python/python-env-tools/bin/pet server
2025-02-19 13:49:19.675 [info] Env ("/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python") in Path resolved as ResolvedPythonEnv { executable: "/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python3.12", prefix: "/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env", version: "3.12.8.final.0", is64_bit: true, symlinks: Some(["/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python", "/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python3.12"]) } and reported as Some(GlobalPaths)
2025-02-19 13:49:19.675 [info] Env ("/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/bin/python") in Path resolved as ResolvedPythonEnv { executable: "/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/bin/python", prefix: "/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8", version: "3.12.8.final.0", is64_bit: true, symlinks: Some(["/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/bin/python"]) } and reported as Some(GlobalPaths)
2025-02-19 13:49:19.675 [info] Discovered env: /nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python3.12
2025-02-19 13:49:19.687 [info] Discovered env: /nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/bin/python
2025-02-19 13:49:19.702 [info] Discovered env: /home/cnf/Documents/Projects/Octopussy/.venv/bin/python
2025-02-19 13:49:19.715 [info] Env ("/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python3") in Path resolved as ResolvedPythonEnv { executable: "/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python3.12", prefix: "/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env", version: "3.12.8.final.0", is64_bit: true, symlinks: Some(["/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python3", "/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python3.12"]) } and reported as Some(GlobalPaths)
2025-02-19 13:49:19.716 [info] Env ("/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/bin/python3") in Path resolved as ResolvedPythonEnv { executable: "/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/bin/python3", prefix: "/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8", version: "3.12.8.final.0", is64_bit: true, symlinks: Some(["/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/bin/python3"]) } and reported as Some(GlobalPaths)
2025-02-19 13:49:19.716 [info] Env ("/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python3.12") in Path resolved as ResolvedPythonEnv { executable: "/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python3.12", prefix: "/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env", version: "3.12.8.final.0", is64_bit: true, symlinks: Some(["/nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python3.12"]) } and reported as Some(GlobalPaths)
2025-02-19 13:49:19.716 [info] Env ("/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/bin/python3.12") in Path resolved as ResolvedPythonEnv { executable: "/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/bin/python3.12", prefix: "/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8", version: "3.12.8.final.0", is64_bit: true, symlinks: Some(["/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/bin/python3.12"]) } and reported as Some(GlobalPaths)
2025-02-19 13:49:19.716 [info] Locator Conda took 19.266342ms
2025-02-19 13:49:19.716 [info] Locator Homebrew took 84.579µs
2025-02-19 13:49:19.716 [info] Locator LinuxGlobal took 432.403µs
2025-02-19 13:49:19.716 [info] Locator PipEnv took 93.495µs
2025-02-19 13:49:19.716 [info] Locator Pixi took 100.96µs
2025-02-19 13:49:19.716 [info] Locator Poetry took 834.93µs
2025-02-19 13:49:19.716 [info] Locator PyEnv took 614.535µs
2025-02-19 13:49:19.716 [info] Locator Venv took 15.569µs
2025-02-19 13:49:19.716 [info] Locator VirtualEnv took 129.574µs
2025-02-19 13:49:19.716 [info] Locator VirtualEnvWrapper took 10.62µs
2025-02-19 13:49:19.716 [info] Locator GlobalVirtualEnvs took 381.337µs
2025-02-19 13:49:19.717 [info] Locator Locators took 19.772844ms
2025-02-19 13:49:19.717 [info] Locator Path took 19.614297ms
2025-02-19 13:49:19.717 [info] Locator Workspaces took 6.57784ms
2025-02-19 13:49:19.717 [info] Refresh completed in 19ms
2025-02-19 13:49:19.718 [warning] Inaccurate Python Environment Info for =>
Environment (Venv)
Executable : /home/cnf/Documents/Projects/Octopussy/.venv/bin/python
Version : 3.12.8
Prefix : /home/cnf/Documents/Projects/Octopussy/.venv
Symlinks : "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3.12"
.
Resolved as =>
Environment (Venv)
Executable : /home/cnf/Documents/Projects/Octopussy/.venv/bin/python
Version : 3.11.11.final.0
Prefix : /home/cnf/Documents/Projects/Octopussy/.venv
Architecture: x64
Symlinks : "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3.11"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3.12"
Incorrect information =>
Environment Some(Venv) incorrectly identified
Version is incorrect
2025-02-19 13:49:19.719 [info] Resolved Python Environment /home/cnf/Documents/Projects/Octopussy/.venv/bin/python
2025-02-19 13:49:19.721 [warning] Inaccurate Python Environment Info for =>
Environment (Venv)
Executable : /home/cnf/Documents/Projects/Octopussy/.venv/bin/python
Version : 3.12.8
Prefix : /home/cnf/Documents/Projects/Octopussy/.venv
Symlinks : "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3.12"
.
Resolved as =>
Environment (Venv)
Executable : /home/cnf/Documents/Projects/Octopussy/.venv/bin/python
Version : 3.11.11.final.0
Prefix : /home/cnf/Documents/Projects/Octopussy/.venv
Architecture: x64
Symlinks : "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3.11"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3.12"
Incorrect information =>
Environment Some(Venv) incorrectly identified
Version is incorrect
2025-02-19 13:49:19.721 [info] Resolved Python Environment /home/cnf/Documents/Projects/Octopussy/.venv/bin/python
2025-02-19 13:49:20.077 [warning] Inaccurate Python Environment Info for =>
Environment (Venv)
Executable : /home/cnf/Documents/Projects/Octopussy/.venv/bin/python
Version : 3.12.8
Prefix : /home/cnf/Documents/Projects/Octopussy/.venv
Symlinks : "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3.12"
.
Resolved as =>
Environment (Venv)
Executable : /home/cnf/Documents/Projects/Octopussy/.venv/bin/python
Version : 3.11.11.final.0
Prefix : /home/cnf/Documents/Projects/Octopussy/.venv
Architecture: x64
Symlinks : "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3.11"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3.12"
Incorrect information =>
Environment Some(Venv) incorrectly identified
Version is incorrect
2025-02-19 13:49:20.100 [info] Resolved Python Environment /home/cnf/Documents/Projects/Octopussy/.venv/bin/python
2025-02-19 13:53:05.218 [warning] Inaccurate Python Environment Info for =>
Environment (Venv)
Executable : /home/cnf/Documents/Projects/Octopussy/.venv/bin/python
Version : 3.12.8
Prefix : /home/cnf/Documents/Projects/Octopussy/.venv
Symlinks : "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3.12"
.
Resolved as =>
Environment (Venv)
Executable : /home/cnf/Documents/Projects/Octopussy/.venv/bin/python
Version : 3.11.11.final.0
Prefix : /home/cnf/Documents/Projects/Octopussy/.venv
Architecture: x64
Symlinks : "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3.11"
: "/home/cnf/Documents/Projects/Octopussy/.venv/bin/python3.12"
Incorrect information =>
Environment Some(Venv) incorrectly identified
Version is incorrect
2025-02-19 13:53:05.218 [info] Resolved Python Environment /home/cnf/Documents/Projects/Octopussy/.venv/bin/python
2025-02-19 13:49:15.748 [info] Experiment 'pythonRecommendTensorboardExt' is active
2025-02-19 13:49:15.748 [info] Experiment 'pythonSurveyNotification' is active
2025-02-19 13:49:15.748 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2025-02-19 13:49:15.748 [info] Experiment 'pythonTestAdapter' is active
2025-02-19 13:49:15.748 [info] Native locator: Refresh started
2025-02-19 13:49:15.890 [info] VS Code was launched from an activated environment: '.venv', selecting it as the interpreter for workspace.
2025-02-19 13:49:17.870 [info] > pyenv which python
2025-02-19 13:49:17.870 [info] cwd: .
2025-02-19 13:49:18.578 [info] > conda info --json
2025-02-19 13:49:19.717 [info] Native locator: Refresh finished in 5011 ms
2025-02-19 13:49:20.102 [info] Python interpreter path: ./.venv/bin/python
2025-02-19 13:49:20.206 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /nix/store/63cr12ggsa70c6054ba9655hgrvivsb1-vscode-extension-ms-python-python-2025.1.2025021102/share/vscode/extensions/ms-python.python/python_files/printEnvVariables.py
2025-02-19 13:49:20.207 [info] shell: zsh
2025-02-19 13:49:20.232 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /nix/store/63cr12ggsa70c6054ba9655hgrvivsb1-vscode-extension-ms-python-python-2025.1.2025021102/share/vscode/extensions/ms-python.python/python_files/printEnvVariables.py
2025-02-19 13:49:20.232 [info] shell: bash
2025-02-19 13:49:20.296 [info] > /nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python3.12 /nix/store/63cr12ggsa70c6054ba9655hgrvivsb1-vscode-extension-ms-python-python-2025.1.2025021102/share/vscode/extensions/ms-python.python/python_files/printEnvVariables.py
2025-02-19 13:49:20.296 [info] shell: zsh
2025-02-19 13:49:20.383 [info] Setting environment variable PYTHONNOUSERSITE in collection to 1 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-02-19 13:49:20.383 [info] Prepending environment variable PATH in collection with /nix/store/63cr12ggsa70c6054ba9655hgrvivsb1-vscode-extension-ms-python-python-2025.1.2025021102/share/vscode/extensions/ms-python.python/python_files/deactivate/zsh:/home/cnf/Documents/Projects/Octopussy/.venv/bin: {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-02-19 13:49:20.384 [info] Send text to terminal: /nix/store/yrb7lrm7m59vdrqcglzwh82zmpvb4fcr-python3-3.12.8-env/bin/python3.12 /nix/store/63cr12ggsa70c6054ba9655hgrvivsb1-vscode-extension-ms-python-python-2025.1.2025021102/share/vscode/extensions/ms-python.python/python_files/printEnvVariablesToFile.py /nix/store/63cr12ggsa70c6054ba9655hgrvivsb1-vscode-extension-ms-python-python-2025.1.2025021102/share/vscode/extensions/ms-python.python/python_files/deactivate/zsh/envVars.txt
2025-02-19 13:49:20.725 [info] Starting Pylance language server.
2025-02-19 13:49:50.386 [error] Failed to initialize deactivate script /home/cnf/.nix-profile/bin/zsh [Error: "/nix/store/63cr12ggsa70c6054ba9655hgrvivsb1-vscode-extension-ms-python-python-2025.1.2025021102/share/vscode/extensions/ms-python.python/python_files/deactivate/zsh/envVars.txt" file not created
at Timeout.<anonymous> (/nix/store/63cr12ggsa70c6054ba9655hgrvivsb1-vscode-extension-ms-python-python-2025.1.2025021102/share/vscode/extensions/ms-python.python/out/client/extension.js:2:312098)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7)]
Extension version: 2025.1.2025021102
VS Code version: Code 1.97.2 (e54c774e0add60467559eb0d1e229c6452cf8447, 2025-02-12T23:20:35.343Z)
OS version: Linux x64 6.13.2
Modes:
- Python version (& distribution if applicable, e.g. Anaconda): 3.11.11
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
- Value of the
python.languageServersetting: Pylance
User Settings
languageServer: "Pylance"
testing
• pytestEnabled: true
• unittestEnabled: true
Installed Extensions
| Extension Name | Extension Id | Version |
|---|---|---|
| black-formatter | ms- | 2024.6.0 |
| cmake-tools | ms- | 1.14.20 |
| code-spell-checker | str | 4.0.21 |
| continue | Con | 0.8.54 |
| cpptools | ms- | 1.22.2 |
| cpptools-extension-pack | ms- | 1.3.0 |
| datawrangler | ms- | 1.7.2 |
| debugpy | ms- | 2024.6.0 |
| direnv | mkh | 0.17.0 |
| EditorConfig | Edi | 0.16.4 |
| gitlens | eam | 16.0.5 |
| go | gol | 0.41.4 |
| hexeditor | ms- | 1.9.11 |
| isort | ms- | 2023.13.13171013 |
| js-debug | ms- | 1.97.1 |
| js-debug-companion | ms- | 1.1.3 |
| jupyter | ms- | 2025.1.0 |
| jupyter-renderers | ms- | 1.0.15 |
| nix-env-selector | arr | 1.0.10 |
| nix-ide | jno | 0.3.5 |
| python | ms- | 2025.1.2025021102 |
| remote-containers | ms- | 0.376.0 |
| remote-explorer | ms- | 0.4.3 |
| remote-repositories | ms- | 0.42.0 |
| remote-server | ms- | 1.5.2 |
| remote-ssh | ms- | 0.78.0 |
| remote-ssh-edit | ms- | 0.86.0 |
| shellcheck | tim | 0.37.7 |
| todo-tree | Gru | 0.0.226 |
| vscode-js-profile-table | ms- | 1.0.10 |
| vscode-jupyter-cell-tags | ms- | 0.1.8 |
| vscode-jupyter-slideshow | ms- | 0.1.5 |
| vscode-pull-request-github | Git | 0.78.1 |
| vscode-pylance | ms- | 2025.2.1 |
| vscode-remote-extensionpack | ms- | 0.26.0 |
| vscode-tailscale | Tai | 0.6.4 |
| vsliveshare | ms- | 1.0.5918 |
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 5 7640U w/ Radeon 760M Graphics (12 x 4540) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: enabled_on direct_rendering_display_compositor: disabled_off_ok gpu_compositing: disabled_software multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: disabled_off video_decode: enabled video_encode: disabled_software vulkan: disabled_off webgl: enabled_readback webgl2: enabled_readback webgpu: disabled_off webnn: disabled_off |
| Load (avg) | 4, 2, 2 |
| Memory (System) | 27.22GB (14.95GB free) |
| Process Argv | --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true --crash-reporter-id e03c7df6-1d72-4b13-b812-82429276134d |
| Screen Reader | no |
| VM | 0% |
| DESKTOP_SESSION | undefined |
| XDG_CURRENT_DESKTOP | Hyprland |
| XDG_SESSION_DESKTOP | undefined |
| XDG_SESSION_TYPE | wayland |
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt551:31179978
vscod805cf:30301675
binariesv615:30325510
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
vscrpc:30673769
962ge761:30959799
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dwnewjupyter:31046869
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc1:31192215
iacca1:31171482
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624
dwoutputscf:31238124
customenabled:31241370
5a9hg449:31230677
hdaa2157:31222309
copilot_t_ci:31222730
jda6j935:31233686
copilothoveron:31240708
Whenning42
Metadata
Metadata
Assignees
Labels
No labels