Skip to content

fix: add pip to environment.yml to prevent system pip fallback#632

Merged
juanitorduz merged 1 commit intomainfrom
fix/environment-pip-dependency
Jan 7, 2026
Merged

fix: add pip to environment.yml to prevent system pip fallback#632
juanitorduz merged 1 commit intomainfrom
fix/environment-pip-dependency

Conversation

@drbenvincent
Copy link
Collaborator

@drbenvincent drbenvincent commented Jan 7, 2026

Summary

This PR fixes an issue where conda env create -f environment.yml would create an environment that uses the wrong pip executable, causing confusing installation errors.

Problem

When setting up the development environment, users encountered this error:

ERROR: Package 'causalpy' requires a different Python: 3.10.16 not in '>=3.11'

This occurred even when the conda environment had Python 3.12+ installed. The root cause:

  1. The environment.yml did not include pip as a dependency
  2. Without pip in the conda environment, the shell falls back to the system pip (e.g., Homebrew's /opt/homebrew/bin/pip on macOS)
  3. The system pip is linked to a different Python version (3.10), causing the version mismatch error

Solution

  1. Added pip as an explicit dependency - This ensures pip is installed within the conda environment and the correct pip is used
  2. Bumped minimum Python from 3.11 to 3.12 - Aligns with current development practices and ensures consistent solver behavior

Testing

After this fix:

  • which pip correctly shows /path/to/mambaforge/envs/CausalPy/bin/pip
  • pip install -e ".[test]" works without version mismatch errors
  • make test runs successfully

📚 Documentation preview 📚: https://causalpy--632.org.readthedocs.build/en/632/

- Added pip as explicit dependency to prevent using system pip
- Bumped minimum Python version from 3.11 to 3.12

Without pip in environment.yml, conda environments fall back to system
pip (e.g., Homebrew's pip on macOS) which may be linked to a different
Python version. This causes confusing errors like 'Package requires a
different Python: 3.10.16 not in >=3.11' even when the conda environment
has Python 3.12+.

Adding pip ensures the correct pip is used within the conda environment.
@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.74%. Comparing base (f5366c0) to head (7eea1c5).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #632      +/-   ##
==========================================
+ Coverage   93.48%   93.74%   +0.26%     
==========================================
  Files          39       41       +2     
  Lines        6031     6827     +796     
  Branches      389      458      +69     
==========================================
+ Hits         5638     6400     +762     
- Misses        255      267      +12     
- Partials      138      160      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@juanitorduz juanitorduz merged commit 5426fb8 into main Jan 7, 2026
11 checks passed
@juanitorduz juanitorduz deleted the fix/environment-pip-dependency branch January 7, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops DevOps related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments