Skip to content

Fix conda named environment creation after conda 25.11#1643

Open
jezdez wants to merge 1 commit into
microsoft:mainfrom
jezdez:fix/conda-env-prefix-discovery
Open

Fix conda named environment creation after conda 25.11#1643
jezdez wants to merge 1 commit into
microsoft:mainfrom
jezdez:fix/conda-env-prefix-discovery

Conversation

@jezdez

@jezdez jezdez commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

conda info --envs --json stopped including envs_dirs in conda 25.11. The extension persisted an empty prefix list and later searched it after conda had successfully created a named environment.

This change:

  • reads envs_dirs from full conda info --json instead of the filtered --envs response
  • treats empty cached prefix lists as stale and retries the query
  • runs named creation with --quiet --json and accepts both the current top-level prefix and legacy actions.PREFIX

References conda/conda#16430 and the named-environment failure in #1454.

@jezdez
jezdez marked this pull request as ready for review July 20, 2026 19:45
@jezdez
jezdez force-pushed the fix/conda-env-prefix-discovery branch from dcedeaa to 2cf3ac7 Compare July 20, 2026 21:02
@edvilme edvilme added the bug Issue identified by VS Code Team member as probable bug label Jul 21, 2026

@edvilme edvilme left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

const state = await getWorkspacePersistentState();
const storedPrefixes = await state.get<string[]>(CONDA_PREFIXES_KEY);
if (storedPrefixes && Array.isArray(storedPrefixes)) {
if (Array.isArray(storedPrefixes) && storedPrefixes.length > 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (Array.isArray(storedPrefixes) && storedPrefixes.length > 0) {
if (storedPrefixes?.length > 0) {

@jezdez jezdez Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't compile with strict TypeScript since storedPrefixes can still be undefined. I'd keep the current check.

eleanorjboyd
eleanorjboyd previously approved these changes Jul 21, 2026

@eleanorjboyd eleanorjboyd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Comment thread src/managers/conda/condaUtils.ts
StellaHuang95
StellaHuang95 previously approved these changes Jul 21, 2026
DonJayamanne
DonJayamanne previously approved these changes Jul 21, 2026
@jezdez
jezdez dismissed stale reviews from DonJayamanne, StellaHuang95, and eleanorjboyd via 5a9041a July 22, 2026 19:18
@jezdez
jezdez force-pushed the fix/conda-env-prefix-discovery branch from 2cf3ac7 to 5a9041a Compare July 22, 2026 19:18

@edvilme edvilme left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes @jezdez :) LGTM

@edvilme
edvilme enabled auto-merge (squash) July 22, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue identified by VS Code Team member as probable bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants