Skip to content

Failed to spawn conda binary #256

@blazerzar

Description

@blazerzar

Today I noticed that the terminal prompt in VS Code does not include the selected (star icon, workspace environment) Conda environment in the Python Environments extension. I did some digging and found that conda info --json fails.

I am not sure when this problem started because I just reinstalled Linux and have only used this system for 2 days.

Step to reproduce

  1. Open VS Code.
  2. Open Python Environments extension side panel.
  3. The list will contain Conda environments and the Conda workspace environment data-science is selected.
  4. Log of Python Environments will contain calls:
    • poetry --version: call succeeds,
    • conda info --json: call fails,
    • poetry --version: call fails.
> conda info --json
Debug: Failed to spawn conda binary conda Error: spawn conda ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn conda',
  path: 'conda',
  spawnargs: [ 'info', '--json' ]
}
Error: Error: Command failed: poetry --version
/bin/sh: line 1: poetry: command not found

    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:518:28)
    at maybeClose (node:internal/child_process:1104:16)
    at Socket.<anonymous> (node:internal/child_process:456:11)
    at Socket.emit (node:events:518:28)
    at Pipe.<anonymous> (node:net:343:12) {
  code: 127,
  killed: false,
  signal: null,
  cmd: 'poetry --version'
}
Debug: Time taken to run poetry --version in ms 79
Debug: Failed to find poetry for poetry
  1. After conda is not found, it starts probing it at some locations.
  2. After VS Code window is refreshed, Conda environments are not listed anymore.
  3. Same errors in the log.

When opening a new instance of VS Code, I can launch (base) Conda terminal by clicking the terminal icon next to it in the list. Clicking the same button for the data-science environment opens the correct terminal (correct Python version), but the prompt (data-science) is missing.

Calling conda info --json works on the system. Using Conda environments manually works as well.

Environment

  • OS: EndeavourOS (up to date)
  • VS Code: 1.98.2
  • Conda: 24.11.3
  • Mamba: 1.5.12
  • Miniforge3: 24.11.3-2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions