-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Problem
When running inside WSL2, PET discovers conda environments from a Windows-side Anaconda installation mounted at /mnt/d/Tools/Anaconda/. It correctly identifies conda_dir = "/mnt/d/Tools/Anaconda" from conda environment metadata, but then fails to locate a conda executable because:
- On Unix,
get_conda_executable()only looks forbin/conda - Windows Anaconda installs place the executable at
Scripts/conda.exe(orcondabin/conda.bat) - The Windows executable at
/mnt/d/Tools/Anaconda/Scripts/conda.exeis a Windows PE binary and not directly usable from WSL
This produces many error log lines like:
ERROR pet_conda: Unable to find Conda Manager for Conda env (even though we have a conda_dir "/mnt/d/Tools/Anaconda"): Env Details = CondaEnvironment { prefix: "/mnt/d/Tools/Anaconda/envs/deepseek", executable: None, version: None, conda_dir: Some("/mnt/d/Tools/Anaconda"), arch: None }
These errors repeat for every environment under the Windows conda installation, spamming the logs and slowing down Conda locator performance (6+ seconds, dominating the total refresh time).
How environments are discovered
The user likely has entries from the Windows-side Anaconda in ~/.conda/environments.txt or .condarc (which can be shared between Windows and WSL). PET then resolves each environment's conda_dir from conda-meta/history or the parent directory structure, finds /mnt/d/Tools/Anaconda, but cannot locate a usable conda binary there.
User setup
- OS: WSL2 (Debian) on Windows 11
- WSL conda: Miniforge3 at
/home/user/miniforge3/bin/conda— works correctly - Windows conda: Anaconda at
D:\Tools\Anaconda(mounted as/mnt/d/Tools/Anacondain WSL) - Shell: Fish
- Reported in Conda Error caused by wrong activate command vscode-python-environments#1313
Relevant code
- Error is emitted at
crates/pet-conda/src/lib.rsline ~302 inLocator::find() - Manager lookup at
crates/pet-conda/src/manager.rs—get_conda_executable()only checksbin/condaon Unix - Environment discovery via
crates/pet-conda/src/environment_locations.rs
Suggested fix options
-
Skip
/mnt/paths on WSL — Detect that aconda_dirunder/mnt/refers to a Windows filesystem and skip manager lookup (these environments are not usable from WSL anyway since the Python binaries are Windows PE executables). -
Downgrade to warning — Change the error to a warning or verbose log to reduce log spam, since this is an expected scenario in WSL environments.
-
Detect and filter cross-OS environments early — In
environment_locations.rs, when parsingenvironments.txtor.condarcon WSL, skip entries under/mnt/mount points since they contain Windows binaries that cannot be executed from Linux.
Option 3 would also avoid the ~6 second Conda locator overhead from trying to resolve environments that can never work.
Logs
Full PET error logs
[pet] ERROR pet_conda: Unable to find Conda Manager for Conda env (even though we have a conda_dir "/mnt/d/Tools/Anaconda"): Env Details = CondaEnvironment { prefix: "/mnt/d/Tools/Anaconda/envs/deepseek", executable: None, version: None, conda_dir: Some("/mnt/d/Tools/Anaconda"), arch: None }
[pet] ERROR pet_conda: Unable to find Conda Manager for Conda env (even though we have a conda_dir "/mnt/d/Tools/Anaconda"): Env Details = CondaEnvironment { prefix: "/mnt/d/Tools/Anaconda", executable: None, version: None, conda_dir: Some("/mnt/d/Tools/Anaconda"), arch: None }
[pet] ERROR pet_conda: Unable to find Conda Manager for Conda env (even though we have a conda_dir "/mnt/d/Tools/Anaconda"): Env Details = CondaEnvironment { prefix: "/mnt/d/Tools/Anaconda/envs/emotion2", executable: None, version: None, conda_dir: Some("/mnt/d/Tools/Anaconda"), arch: None }
... (repeated for every environment under /mnt/d/Tools/Anaconda/envs/)