Skip to content

Prefix conda environment gets run by name instead of path #24627

@karthiknadig

Description

@karthiknadig

Discussed in #24626

Originally posted by gandhis1 December 17, 2024
In version 2024.16.1, when I run test discovery, or really any command that ultimately invokes conda, I see the following:

2024-12-17 10:09:14.508 [info] > conda run -p ./envs/linux_main --no-capture-output python ~/.vscode-server/extensions/ms-python.python-2024.16.1-linux-x64/python_files/get_output_via_markers.py -m pytest -p vscode_pytest --collect-only .

This works, and this is what I expect, since my environments are nameless and path-based. Here is the anonymized output of conda info --env:

                         /home/myuser/git/myrepo/envs/linux_arctic
                         /home/myuser/git/myrepo/envs/linux_main
base                  *  /opt/miniconda3

In recent versions (this has been ongoing for several weeks I believe), I see this (2024.23.2024121701):

2024-12-17 10:32:03.637 [info] > ~/git/myrepo2/envs/linux_py38/bin/conda run -n linux_main --no-capture-output python ~/.vscode-server/extensions/ms-python.python-2024.23.2024121701-linux-x64/python_files/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2024.23.2024121701-linux-x64/python_files/printEnvVariables.py
2024-12-17 10:32:03.637 [info] shell: bash
2024-12-17 10:32:04.012 [error] getActivatedEnvironmentVariables Error: Command failed: /home/myuser/git/myrepo/envs/linux_py38/bin/conda run -n linux_main --no-capture-output python /home/myuser/.vscode-server/extensions/ms-python.python-2024.23.2024121701-linux-x64/python_files/get_output_via_markers.py /home/myuser/.vscode-server/extensions/ms-python.python-2024.23.2024121701-linux-x64/python_files/printEnvVariables.py

EnvironmentLocationNotFound: Not a conda environment: /home/myuser/git/myrepo/envs/239fb791f5e1df62ec6015e65582c32020a01c5d/envs/linux_main


    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:530:35)
    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: 1,
  killed: false,
  signal: null,
  cmd: '/home/myuser/git/myrepo2/envs/linux_py38/bin/conda run -n linux_main --no-capture-output python /home/myuser/.vscode-server/extensions/ms-python.python-2024.23.2024121701-linux-x64/python_files/get_output_via_markers.py /home/myuser/.vscode-server/extensions/ms-python.python-2024.23.2024121701-linux-x64/python_files/printEnvVariables.py'
}

Fundamentally, the issue I see is that this should be using -p and not -n. It's also using a somewhat arbitrary conda executable.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugtriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions