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

A failure to find an environment prevents Pylance from loading #24211

Open
rchiodo opened this issue Sep 30, 2024 · 0 comments
Open

A failure to find an environment prevents Pylance from loading #24211

rchiodo opened this issue Sep 30, 2024 · 0 comments
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug needs PR Ready to be worked on

Comments

@rchiodo
Copy link

rchiodo commented Sep 30, 2024

Type: Bug

Behaviour

If the default interpreter is set to a non existent (or deleted venv), Pylance will fail to launch.

Steps to reproduce:

  1. Create a folder
  2. Create a venv in that folder
  3. Create a python file in that folder
  4. Set the interpreter for that folder to that venv
  5. Close folder
  6. Delete venv
  7. Reopen folder
  8. No intellisense

Diagnostic data

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

2024-09-30 10:41:36.010 [info] Experiment 'All' is active
2024-09-30 10:41:36.011 [info] Native locator: Refresh started
2024-09-30 10:41:36.011 [info] Default formatter is set to ms-python.black-formatter for workspace c:\Users\rchiodo\source\testing\notebooks
2024-09-30 10:41:36.032 [error] Python Extension: interpreterManager.refresh [l [Error]: Failed to resolve env "C:\\Users\\rchiodo\\source\\repos\\debugpy\\.venv11"
	at ae (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2052103)
	at oe (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2050063)
	at Immediate.<anonymous> (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2046357)
	at process.processImmediate (node:internal/timers:483:21)] {
  code: -4,
  data: undefined
}
2024-09-30 10:41:36.061 [info] > pyenv which python
2024-09-30 10:41:36.061 [info] cwd: .
2024-09-30 10:41:38.707 [info] Conda environment manager found at: C:\Users\rchiodo\AppData\Local\anaconda3\Scripts\conda.exe
2024-09-30 10:41:38.955 [info] Conda environment manager found at: C:\Users\rchiodo\source\testing\test_pylance\CondaEnv\Scripts\conda.exe
2024-09-30 10:41:38.960 [info] Native locator: Refresh finished in 3077 ms
2024-09-30 10:41:38.973 [error] [
  'getActivatedEnvironmentVariables, Class name = j, completed in 0ms, has a falsy return value, Arg 1: <Uri:c:\\Users\\rchiodo\\source\\testing\\notebooks>, Arg 2: undefined, Arg 3: undefined, Arg 4: "C:\\\\WINDOWS\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe"',
  [l [Error]: Failed to resolve env "C:\\Users\\rchiodo\\source\\repos\\debugpy\\.venv11"
  	at ae (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2052103)
  	at oe (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2050063)
  	at Immediate.<anonymous> (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2046357)
  	at process.processImmediate (node:internal/timers:483:21)] {
    code: -4,
    data: undefined
  }
]
2024-09-30 10:41:38.973 [error] Failed to apply terminal env vars undefined [l [Error]: Failed to resolve env "C:\\Users\\rchiodo\\source\\repos\\debugpy\\.venv11"
	at ae (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2052103)
	at oe (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2050063)
	at Immediate.<anonymous> (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2046357)
	at process.processImmediate (node:internal/timers:483:21)] {
  code: -4,
  data: undefined
}
2024-09-30 10:41:38.973 [error] [
  'Failed to activate a workspace, Class name = v, completed in 2994ms, has a falsy return value, Arg 1: <Uri:c:\\Users\\rchiodo\\source\\testing\\notebooks>, Arg 2: {"started":1727718095812}, Return Value: undefined',
  [l [Error]: Failed to resolve env "C:\\Users\\rchiodo\\source\\repos\\debugpy\\.venv11"
  	at ae (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2052103)
  	at oe (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2050063)
  	at Immediate.<anonymous> (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2046357)
  	at process.processImmediate (node:internal/timers:483:21)] {
    code: -4,
    data: undefined
  }
]
2024-09-30 10:41:38.973 [error] Failure during activation. [l [Error]: Failed to resolve env "C:\\Users\\rchiodo\\source\\repos\\debugpy\\.venv11"
	at ae (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2052103)
	at oe (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2050063)
	at Immediate.<anonymous> (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2046357)
	at process.processImmediate (node:internal/timers:483:21)] {
  code: -4,
  data: undefined
}
2024-09-30 10:41:38.974 [error] sendStartupTelemetry() failed. [l [Error]: Failed to resolve env "C:\\Users\\rchiodo\\source\\repos\\debugpy\\.venv11"
	at ae (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2052103)
	at oe (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2050063)
	at Immediate.<anonymous> (c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\out\client\extension.js:2:2046357)
	at process.processImmediate (node:internal/timers:483:21)] {
  code: -4,
  data: undefined
}
2024-09-30 10:41:55.945 [info] > ~\source\testing\test_pylance\CondaEnv\Scripts\conda.exe info --json
2024-09-30 10:41:59.311 [info] > ~\source\testing\test_pylance\CondaEnv\Scripts\conda.exe run -n bk-tutorial --no-capture-output python ~\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\python_files\get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2024.15.2024092702-win32-x64/python_files/printEnvVariables.py
2024-09-30 10:41:59.311 [info] shell: commandPrompt
2024-09-30 10:41:59.311 [info] > ~\source\testing\test_pylance\CondaEnv\Scripts\conda.exe run -n bk-tutorial --no-capture-output python ~\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\python_files\get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2024.15.2024092702-win32-x64/python_files/printEnvVariables.py
2024-09-30 10:41:59.311 [info] shell: commandPrompt
2024-09-30 10:42:00.866 [error] getActivatedEnvironmentVariables Error: Command failed: C:\Users\rchiodo\source\testing\test_pylance\CondaEnv\Scripts\conda.exe run -n bk-tutorial --no-capture-output python c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\python_files\get_output_via_markers.py c:/Users/rchiodo/.vscode-insiders/extensions/ms-python.python-2024.15.2024092702-win32-x64/python_files/printEnvVariables.py

EnvironmentLocationNotFound: Not a conda environment: C:\Users\rchiodo\source\testing\test_pylance\CondaEnv\envs\bk-tutorial


    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:423:12)
    at ChildProcess.emit (node:events:531:35)
    at maybeClose (node:internal/child_process:1105:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'C:\\Users\\rchiodo\\source\\testing\\test_pylance\\CondaEnv\\Scripts\\conda.exe run -n bk-tutorial --no-capture-output python c:\\Users\\rchiodo\\.vscode-insiders\\extensions\\ms-python.python-2024.15.2024092702-win32-x64\\python_files\\get_output_via_markers.py c:/Users/rchiodo/.vscode-insiders/extensions/ms-python.python-2024.15.2024092702-win32-x64/python_files/printEnvVariables.py'
}
2024-09-30 10:42:00.886 [error] getActivatedEnvironmentVariables Error: Command failed: C:\Users\rchiodo\source\testing\test_pylance\CondaEnv\Scripts\conda.exe run -n bk-tutorial --no-capture-output python c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.python-2024.15.2024092702-win32-x64\python_files\get_output_via_markers.py c:/Users/rchiodo/.vscode-insiders/extensions/ms-python.python-2024.15.2024092702-win32-x64/python_files/printEnvVariables.py

EnvironmentLocationNotFound: Not a conda environment: C:\Users\rchiodo\source\testing\test_pylance\CondaEnv\envs\bk-tutorial


    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:423:12)
    at ChildProcess.emit (node:events:531:35)
    at maybeClose (node:internal/child_process:1105:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'C:\\Users\\rchiodo\\source\\testing\\test_pylance\\CondaEnv\\Scripts\\conda.exe run -n bk-tutorial --no-capture-output python c:\\Users\\rchiodo\\.vscode-insiders\\extensions\\ms-python.python-2024.15.2024092702-win32-x64\\python_files\\get_output_via_markers.py c:/Users/rchiodo/.vscode-insiders/extensions/ms-python.python-2024.15.2024092702-win32-x64/python_files/printEnvVariables.py'
}
2024-09-30 10:42:19.391 [info] Native locator: Refresh started
2024-09-30 10:42:19.554 [info] Conda environment manager found at: C:\Users\rchiodo\AppData\Local\anaconda3\Scripts\conda.exe
2024-09-30 10:42:19.595 [info] Conda environment manager found at: C:\Users\rchiodo\source\testing\test_pylance\CondaEnv\Scripts\conda.exe
2024-09-30 10:42:19.612 [info] Native locator: Refresh finished in 221 ms
2024-09-30 10:43:09.626 [info] Native locator: Refresh started
2024-09-30 10:43:09.790 [info] Conda environment manager found at: C:\Users\rchiodo\AppData\Local\anaconda3\Scripts\conda.exe
2024-09-30 10:43:09.852 [info] Conda environment manager found at: C:\Users\rchiodo\source\testing\test_pylance\CondaEnv\Scripts\conda.exe
2024-09-30 10:43:09.898 [info] Native locator: Refresh finished in 249 ms
2024-09-30 10:43:15.483 [info] Discover tests for workspace name: notebooks - uri: c:\Users\rchiodo\source\testing\notebooks
2024-09-30 10:43:15.483 [info] Python interpreter path: ~\AppData\Local\Microsoft\WindowsApps\python3.11.exe
2024-09-30 10:43:15.491 [info] > pixi --version

Extension version: 2024.15.2024092702
VS Code version: Code - Insiders 1.94.0-insider (b7894e64dd103a19dd5015326d8310232236de0f, 2024-09-30T12:16:57.458Z)
OS version: Windows_NT x64 10.0.26100
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.9
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): MicrosoftStore
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

experiments
• optInto: ["All"]

Installed Extensions
Extension Name Extension Id Version
Black Formatter ms-python.black-formatter 2024.3.12071014
ESLint dbaeumer.vscode-eslint 3.0.10
GitHub Copilot GitHub.copilot 1.234.1129
GitHub Copilot Chat GitHub.copilot-chat 0.21.2024092703
Italian Language Pack for Visual Studio Code MS-CEINTL.vscode-language-pack-it 1.94.2024092509
JavaScript Debugger ms-vscode.js-debug 1.94.0
JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.3
Jupyter ms-toolsai.jupyter 2024.9.2024092401
Jupyter Cell Tags ms-toolsai.vscode-jupyter-cell-tags 0.1.9
Jupyter Keymap ms-toolsai.jupyter-keymap 1.1.2
Jupyter Notebook Renderers ms-toolsai.jupyter-renderers 1.0.19
Jupyter Slide Show ms-toolsai.vscode-jupyter-slideshow 0.1.6
Live Share ms-vsliveshare.vsliveshare 1.0.5941
Playwright Test for VSCode ms-playwright.playwright 1.1.7
Prettier - Code formatter esbenp.prettier-vscode 11.0.0
Pylance ms-python.vscode-pylance 2024.9.102
Python ms-python.python 2024.15.2024092702
Python Debugger ms-python.debugpy 2024.11.2024092501
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.10
WSL ms-vscode-remote.remote-wsl 0.88.4
System Info
Item Value
CPUs AMD EPYC 7763 64-Core Processor (16 x 2445)
GPU Status 2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: unavailable_software
webnn: disabled_off
Load (avg) undefined
Memory (System) 63.95GB (40.84GB free)
Process Argv --folder-uri file:///c%3A/Users/rchiodo/source/testing/notebooks --enable-proposed-api msft-1es.es-chat --crash-reporter-id fb5f004c-0c45-4402-af67-bb66466f13d8
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vsc_aacf:30263846
vscod805:30301674
vsaa593:30376534
py29gd2263:31024238
c4g48928:30535728
a9j8j154:30646983
962ge761:30841072
f8hc8238:30694864
pythongtdpath:30726887
welcomedialog:30812478
pythonnoceb:30776497
asynctok:30898717
dsvsc014:30777825
dsvsc015:30821418
pythonmypyd1:30859725
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30870582
dsvsc016:30879898
dsvsc017:30880771
dsvsc018:30880772
cppperfnew:30980852
pythonait:30973460
724cj586:31013169
a69g1124:31018687
dvdeprecation:31040973
dwnewjupytercf:31046870
nb_pkg_only:31057982
nativerepl1:31134653
refactort:31084545
pythonrstrctxt:31093868
flighttreat:31119334
wkspc-onlycs-t:31132770
nativeloc1:31118317
wkspc-ranged-c:31125598
cf971741:31144450
e80f6927:31120813
defaultse:31146405
i21gd607:31141543
iacca1:31144502
notype1:31143044
b50ed353:31138333
showchatpanel:31139797
f8igb616:31140137

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Sep 30, 2024
@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug needs PR Ready to be worked on area-environments Features relating to handling interpreter environments and removed triage-needed Needs assignment to the proper sub-team labels Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug needs PR Ready to be worked on
Projects
None yet
Development

No branches or pull requests

2 participants