Skip to content

Extension fails to activate unnamed conda environments #24095

Closed

Description

Description:

Extension is unable to activate unnamed conda environments created using the conda create -p command after the latest update. Previously, these environments were activated correctly. No changes were made to the environments themselves, only VS Code and the Python extension were updated. Named conda environments continue to activate without issue.

Steps to reproduce:

  1. Create an unnamed conda environment using the following command:
    conda create -p ./env
  2. Open a project folder in VS Code that uses this unnamed environment.
  3. Attempt to select the environment as the Python interpreter for the project using the Python extension.

Expected behavior:

The Python extension should successfully activate the unnamed conda environment and correctly load its packages, as it did before the update.

Actual behavior:

The Python extension fails to activate the environment and displays an error message, indicating "EnvironmentLocationNotFound". The wrong Python interpreter may be selected, leading to issues with code execution and package resolution.

Logs:

2024-09-12 01:04:26.645 [error] getActivatedEnvironmentVariables Error: Command failed: conda run -n env --no-capture-output python /home/<USER>/.vscode-server/extensions/ms-python.python-2024.14.0-linux-x64/python_files/get_output_via_markers.py /home/<USER>/.vscode-server/extensions/ms-python.python-2024.14.0-linux-x64/python_files/printEnvVariables.py

EnvironmentLocationNotFound: Not a conda environment: /home/<USER>/miniconda3/envs/env

    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 Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:519:28)
    at Pipe.<anonymous> (node:net:338:12) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'conda run -n env --no-capture-output python /home/<USER>/.vscode-server/extensions/ms-python.python-2024.14.0-linux-x64/python_files/get_output_via_markers.py /home/<USER>/.vscode-server/extensions/ms-python.python-2024.14.0-linux-x64/python_files/printEnvVariables.py'
}

Environment:

  • VS Code version: Version: 1.93.0 (user setup)
  • Python extension version: v2024.14.0
  • Conda version: 24.7.1
  • Operating System: Ubuntu 20.04.3 LTS in WSL 2

Additional information:

  • This issue only occurs with unnamed conda environments. Named environments activate correctly.
  • The issue appeared after updating VS Code and the Python extension today. Previously, unnamed environments worked as expected.
  • It seems the problem might lie in the conda run command used by the extension. The logs show it's attempting to activate an environment named "env", but the unnamed environment doesn't have a name and is located at "./env", not "/home/USER/miniconda3/envs/env".

I have tried restarting VS Code and reinstalling the Python extension, but the issue persists.

Please investigate this issue and provide a fix to restore the ability to activate unnamed conda environments within the Python extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

area-environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions