vscode-python: Indefinitely "Discovering Python Interpreters" due to faulty conda binary

Type: Bug

Behaviour

Expected vs. Actual

When i open a python project the language server never loads. It just stalls on “discovering python interpreters” forever.

In the output section i’ve put just one example of the errors ms-python is outputting. All the other errors are copies of the ones there but with different environment names and python versions. It looks like it’s searching for my old, deleted virtualenvs. I don’t know where it’s saving its information about those old envs or i’d delete that.

Steps to reproduce:

  1. Open a python project with vscode-remote on my machine?

I’m sure it’s something weird about my setup but i can’t pin it down. I’ve reinstalled vscode, vscode-server, all extensions, ect. image

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.2
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): PipEnv
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2023-09-21 14:16:59.993 [warning] Identifier for virt-virtualenv failed to identify /home/ablacklama/.virtualenvs/pyx_analysis-3.9/bin/python [Error: ENOENT: no such file or directory, scandir '/home/ablacklama/.virtualenvs/pyx_analysis-3.9/bin'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: '/home/ablacklama/.virtualenvs/pyx_analysis-3.9/bin'
}
2023-09-21 14:17:04.010 [error] Error: Command failed: /home/ablacklama/.virtualenvs/pyx_analysis-3.9/bin/python -I /home/ablacklama/.vscode-server/extensions/ms-python.python-2023.16.0/pythonFiles/get_output_via_markers.py /home/ablacklama/.vscode-server/extensions/ms-python.python-2023.16.0/pythonFiles/interpreterInfo.py
/bin/sh: 1: /home/ablacklama/.virtualenvs/pyx_analysis-3.9/bin/python: not found

    at ChildProcess.exithandler (node:child_process:420:12)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1091:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at Pipe.<anonymous> (node:net:322:12) {
  code: 127,
  killed: false,
  signal: null,
  cmd: '/home/ablacklama/.virtualenvs/pyx_analysis-3.9/bin/python -I /home/ablacklama/.vscode-server/extensions/ms-python.python-2023.16.0/pythonFiles/get_output_via_markers.py /home/ablacklama/.vscode-server/extensions/ms-python.python-2023.16.0/pythonFiles/interpreterInfo.py'
}

User Settings


languageServer: "Pylance"

formatting
• provider: "none"
• blackArgs: "<placeholder>"

testing
• promptToConfigure: false
• pytestArgs: "<placeholder>"
• pytestEnabled: true

Extension version: 2023.16.0 VS Code version: Code 1.82.2 (abd2f3db4bdb28f9e95536dfa84d8479f1eb312d, 2023-09-14T05:55:25.390Z) OS version: Windows_NT x64 10.0.22621 Modes: Remote OS version: Linux x64 5.15.0-83-generic

System Info
Item Value
CPUs AMD Ryzen 9 5900X 12-Core Processor (24 x 3700)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 31.94GB (12.57GB free)
Process Argv –crash-reporter-id 0e2b899c-1a5d-43cb-be1d-1dada59d9714
Screen Reader no
VM 0%
Item Value
Remote SSH: cahserver
OS Linux x64 5.15.0-83-generic
CPUs AMD Ryzen Threadripper 3970X 32-Core Processor (64 x 3997)
Memory (System) 251.54GB (242.35GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263cf:30792227
vscaac:30438847
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
3biah626:30602489
89544117:30613380
showlangstatbar:30737416
03d35959:30757346
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxpt:30805730
pythonnoceb:30805159
copilotsettingc:30839828
synctok:30821570
dsvsc013:30795093
dsvsc014:30804076
diffeditorv2:30821572
dsvsc015cf:30829746
pythonfb280951cf:30830811

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 25

Commits related to this issue

Most upvoted comments

No worries, and thanks for all the help 🙂 I’ve created a fix to bypass such problematic conda binaries on the system, ensuring discovery can complete even when they’re present: https://github.com/microsoft/vscode-python/pull/22072.

Yes ~/miniconda3/bin/conda did exist. Out of curiosity I tried calling ~/miniconda3/bin/conda info --json it manually and it just hung and never returned.

Awesome. Happy to help unblock you.

In the logs you sent me I don’t see any, but let us know if that causes any trouble in the future.

Oh that looks like it worked! I just deleted the miniconda3 folder entirely since i wasn’t using it and it’s no longer stuck on discovering interpreters. Thanks a lot!

As a side note it still looks for old environments that don’t exist, but at least that’s not causing any issues on my side. Just some errors in the logs.

spencer[redacted]@gmail.com