Skip to content

PET conda locator fails to find conda manager for Windows conda installations accessed via WSL /mnt/ paths #369

@karthiknadig

Description

@karthiknadig

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 for bin/conda
  • Windows Anaconda installs place the executable at Scripts/conda.exe (or condabin/conda.bat)
  • The Windows executable at /mnt/d/Tools/Anaconda/Scripts/conda.exe is 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

Relevant code

  • Error is emitted at crates/pet-conda/src/lib.rs line ~302 in Locator::find()
  • Manager lookup at crates/pet-conda/src/manager.rsget_conda_executable() only checks bin/conda on Unix
  • Environment discovery via crates/pet-conda/src/environment_locations.rs

Suggested fix options

  1. Skip /mnt/ paths on WSL — Detect that a conda_dir under /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).

  2. 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.

  3. Detect and filter cross-OS environments early — In environment_locations.rs, when parsing environments.txt or .condarc on 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/)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions