Fix: Add Homebrew Caskroom paths for conda base environment discovery #237
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where PET fails to discover the base conda environment when conda is installed via Homebrew cask on macOS.
Problem
Users with conda installed via Homebrew cask (e.g.,
brew install --cask miniforge
) were experiencing missing base conda environments in VS Code's Python interpreter selection. The conda manager was detected correctly, but the base environment was not discovered.Example of the issue:
Root Cause
The conda locator in
get_known_conda_install_locations()
was only searching for conda installations in standard Homebrew paths like:/opt/homebrew/anaconda3
/opt/homebrew/miniconda3
/opt/homebrew/miniforge3
However, Homebrew cask installations place conda in the
Caskroom
subdirectory:/opt/homebrew/Caskroom/miniforge/base
/opt/homebrew/Caskroom/miniconda/base
/opt/homebrew/Caskroom/anaconda/base
These paths were not included in the search locations, causing the base environments to be missed.
Solution
Added the missing Homebrew Caskroom paths to the known conda install locations for macOS:
This ensures that PET will now discover conda base environments installed via Homebrew cask, while maintaining full compatibility with existing conda installations.
Testing
Fixes #236.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.