"Failed to create conda environment" after the env is actually created — conda info --envs --json no longer returns envs_dirs (conda 26.x)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript, vscode
- Ambito
- developer-experience, tooling
Direzione di ricerca
Inizia individuando l’helper env-dirs e i percorsi di cache-hit e cache-write di CONDA_PREFIXES_KEY descritti nell’issue. Confronta la risposta di conda info --envs --json con la risposta non filtrata, quindi verifica che la creazione di un ambiente risolva correttamente il suo prefix, eviti di mettere in cache un valore envs_dirs vuoto e non segnali più un falso errore.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
| Extension | ms-python.vscode-python-envs 1.36.0 |
| VS Code | 1.136.1 (Windows 11, 10.0.26200) |
| conda | 26.7.2 (miniforge3) |
Steps to reproduce
- Python: Create Environment → Conda → Named (with an English display language).
- Pick a Python version, enter a name (
test).
Actual
conda itself succeeds — the output channel shows the whole transaction completing:
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
#
# To activate this environment, use
#
# $ conda activate test
and then the extension fails:
[info] Using conda from cache: C:\Users\...\miniforge3\Library\bin\conda.BAT
[info] Ran conda in 697: C:\Users\...\miniforge3\Library\bin\conda.BAT info --envs --json
[warning] conda info envs_dirs is undefined/null
[error] Failed to create conda environment A system error occurred
(ENOENT: no such file or directory, scandir
'C:\Users\...\AppData\Local\Programs\Microsoft VS Code\conda-meta')
The environment is created and fully usable. Only the post-creation prefix lookup fails — but the user is shown Failed to create conda environment, which reads as though nothing was created.
Cause
The env-dirs helper calls conda info --envs --json and reads envs_dirs from it:
const e = await H(["info", "--envs", "--json"]);
const t = JSON.parse(e);
const n = t.envs_dirs;
return null == n
? (traceWarn("conda info envs_dirs is undefined/null"), { envs_dirs: [] })
: Array.isArray(n)
? { envs_dirs: n }
: { envs_dirs: [] };
As of conda 26.x, conda info --envs --json returns only envs and envs_details. envs_dirs is present only in the unfiltered conda info --json:
$ conda info --envs --json
{
"envs": [
"C:\\Users\\...\\miniforge3",
"C:\\Users\\...\\miniforge3\\envs\\test",
...
],
"envs_details": { ... }
}
# no envs_dirs key
$ conda info --json | findstr envs_dirs
"envs_dirs": [ ... ]
So envs_dirs becomes []. The empty list makes the subsequent prefix search join an empty base path, and conda-meta ends up resolved relative to the process cwd — VS Code's own install directory — which is the ENOENT above.
Aggravating factor
The empty result is cached, and the cache-hit check accepts an empty array:
const n = await e.get(CONDA_PREFIXES_KEY);
if (n && Array.isArray(n)) return j = n, j; // [] passes this check
...
j = n.envs_dirs; // []
await e.set(CONDA_PREFIXES_KEY, ...); // and gets cached
Once it has failed, the bad [] is served from cache on later attempts, so the failure persists until the cache is cleared.
Suggested fix
- Read
envs_dirsfromconda info --json(orconda config --show envs_dirs --json) instead ofconda info --envs --json. - Better still, derive the new environment's prefix from the
envsarray that the same response already returns — it contains the full path of the environment that was just created. - Treat an empty
envs_dirsas a failure rather than a value: don't cache it, and require a non-empty array on the cache-hit path.
- Lingua principale
- TypeScript
- Stelle
- 140
- Fork
- 63
- Merge medio
- 1g 4h
- PR unite (30g)
- 35
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/vscode-python-environments
-
microsoft/vscode-python-environments#1799 · 1 assegnatario ·
-
microsoft/vscode-python-environments#1796 · 1 assegnatario ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
triage-needed
microsoft/vscode-python-environments#1791 · 1 reazione · 2 assegnatari ·
-
triage-needed
Difficoltà 4/5 3-5 giorni Idoneità per principianti 74/100
microsoft/vscode-python-environments#1779 · 1 commento · 1 reazione ·
Tutte le issue di microsoft/vscode-python-environments
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
0xMiden/bridge-portal#132 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
area:tools bug good first issue help wanted priority:P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
TaewoooPark/Motifcode#14 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
newrelic-experimental/preflight#793 · 1 commento ·