Repository navigation
Loosen numpy/pandas/pydantic/scikit-learn/narwhals pins so Colab installs don't downgrade - #1287
Merged
Merged
Conversation
…alls don't downgrade The ~= pins forced numpy 2.2.x, pandas 2.3.x, pydantic 2.11.x, scikit-learn 1.7.x and narwhals 2.13.x. Google Colab preinstalls numpy 2.1.3, pandas 2.2.3, pydantic 2.13.5, scikit-learn 1.6.1 and narwhals 2.26.0, so installing PyHealth replaced packages Colab had already imported and the first import failed until the runtime was restarted. Use bounded ranges whose lower bounds cover Colab's versions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
Five core dependencies use
~=pins that hold them to one minor version:numpy~=2.2.0,pandas~=2.3.1,pydantic~=2.11.7,scikit-learn~=1.7.0andnarwhals~=2.13.0. Google Colab preinstalls different versions, according to googlecolab/backend-infopip-freeze.txt(updated 2026-10-02, Python 3.13):pip install pyhealthon Colab~=2.2.0~=2.3.1~=2.11.7(<2.12)~=1.7.0~=2.13.0(<2.14)Colab has already imported numpy and pandas by the time a notebook runs pip. After the swap, the first
import pyhealthfails with'numpy.ufunc' object has no attribute '__module__'until the runtime is restarted, and pip prints resolver conflicts for other preinstalled packages. The tutorial series in #1281 works around this with an install cell that restarts the runtime. Once this is released, the plainpip installwill work without that restart.What
Bounded ranges whose lower bounds cover Colab's versions:
numpy>=2.1,<3. PyHealth needs NumPy 2 (np.trapezoidintasks/eegbci.py).pandas>=2.2,<3pydantic>=2.11,<3. It's only used for the dataset config models (field_validator, pydantic v2 API).scikit-learn>=1.6,<2narwhals>=2.13,<3The upper bounds stay at the next major version because pandas 3, numpy 3 and pydantic 3 compatibility is untested.
polars~=1.35.2,mne~=1.10.0,orjson~=3.10andmore-itertools~=10.8.0already match or don't conflict with Colab, so they're unchanged. This follows the style of #1254.Tests
I ran the full core suite (
python -m unittest discover -t tests -s tests/core, 1463 tests) on macOS with Python 3.13, in two fresh venvs:pip resolved
pip install -e ".[xgboost]"together with the Colab versions with no conflicts. That confirms no other dependency forces the newer versions.tools/check_pr_rules.pypasses.🤖 Generated with Claude Code