Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug version resolution and conda/wheel interactions #2659

Open
adrinjalali opened this issue Dec 6, 2024 · 2 comments
Open

Debug version resolution and conda/wheel interactions #2659

adrinjalali opened this issue Dec 6, 2024 · 2 comments

Comments

@adrinjalali
Copy link

I have a not-so-trivial setup to test with multiple versions of dependencies:

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64", "osx-arm64", "osx-64", "win-64"]

[tool.pixi.dependencies]
# scikit-learn is not included here since it's included explicitly in each task's
# dependencies either from conda or pypi (pre-release).
rich = ">=12"

[tool.pixi.pypi-dependencies]
skops = { path = ".", editable = true }

[tool.pixi.feature.docs.dependencies]
# To be synced with the versions in docs/requirements.txt
matplotlib = ">=3.3"
pandas = ">=1"
sphinx = ">=3.2.0"
sphinx-gallery = ">=0.7.0"
sphinx-rtd-theme = ">=1"
numpydoc = ">=1.0.0"
sphinx-prompt = ">=1.3.0"
sphinx-issues = ">=1.2.0"

[tool.pixi.feature.docs.pypi-dependencies]
# everything that depends on scikit-learn needs to be a pypi dependency so that this
# spec is compatible with the nightly build environment.
fairlearn = ">=0.7.0"

[tool.pixi.feature.tests.dependencies]
pytest = ">=7"
pytest-cov = ">=2.9.0"
flake8 = ">=3.8.2"
types-requests = ">=2.28.5"
flaky = ">=3.7.0"
rich = ">=12"
matplotlib = ">=3.3"
pandas = ">=1"

[tool.pixi.feature.tests.pypi-dependencies]
# these are packages that require scikit-learn. They need to be as a pypi dependency
# because otherwise there will be a package resolution conflict between pypi and conda
# when installing pre-release nightly release.
lightgbm = ">=3"
xgboost = ">=1.6"

[tool.pixi.feature.min-deps.dependencies]
python = "=3.9"
# all version constraints for this package seem to resolve to the latest. so leaving it
# as is.
quantile-forest = "=1.3.11"
scikit-learn = "~=1.1.0"
pytest = "=7"
pytest-cov = "=2.9.0"
flake8 = "=3.8.2"
types-requests = "=2.28.5"
flaky = "=3.7.0"
catboost = "~=1.0"
rich = "=12"
matplotlib = "=3.3"
pandas = "=1"
lightgbm = "=3"
xgboost = "=1.6"


[tool.pixi.feature.lint.dependencies]
pre-commit = "*"

[tool.pixi.feature.dev.dependencies]
ipython = "*"

[tool.pixi.feature.sklearn11.dependencies]
scikit-learn = "~=1.1.0"
pandas = "~=1.4"
numpy = "~=1.22"
scipy = "~=1.8"
fairlearn = "~=0.7"
catboost = ">=1.0"
python = "=3.9"

[tool.pixi.feature.sklearn12.dependencies]
scikit-learn = "~=1.2.0"
pandas = "~=1.5"
numpy = "~=1.24"
scipy = "~=1.9"
fairlearn = "~=0.8"
catboost = ">=1.0"
python = "=3.10"

[tool.pixi.feature.sklearn13.dependencies]
scikit-learn = "~=1.3.0"
pandas = "~=2.0"
numpy = "~=1.25"
scipy = "~=1.10"
fairlearn = "~=0.9"
catboost = ">=1.0"
python = "=3.11"

[tool.pixi.feature.sklearn14.dependencies]
scikit-learn = "~=1.4.0"
pandas = "~=2.1"
numpy = "~=1.26"
scipy = "~=1.11"
fairlearn = "~=0.10"
catboost = ">=1.0"
python = "=3.12"

[tool.pixi.feature.sklearn15.dependencies]
scikit-learn = "~=1.5"
fairlearn = "~=0.10"
pandas = "~=2.1"
numpy = "~=2.0"
scipy = "~=1.13"
python = "=3.13"
quantile-forest = "~=1.3.11"

[tool.pixi.feature.sklearn16]
# TODO: comment this out once scikit-learn 1.6 is released and keep for testing against
# the next release candidate.
channels = [
    {channel = "conda-forge/label/scikit-learn_rc", priority = 2},
    {channel = "conda-forge", priority = 1},
]

[tool.pixi.feature.sklearn16.dependencies]
scikit-learn = "*"
fairlearn = "~=0.11"
pandas = "~=2.2"
numpy = "~=2.1"
scipy = "~=1.9"
# add when catboost supports 3.13
# https://github.com/catboost/catboost/issues/2748
# catboost = ">=1.0"
# add quantile-forest when it's released
# https://github.com/zillow/quantile-forest/issues/103
# quantile-forest = "~=1.4"
python = "=3.13"

[tool.pixi.feature.sklearn17.pypi-options]
# This is for the nightly channel to test the dev version of scikit-learn.
extra-index-urls = ["https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"]

[tool.pixi.feature.sklearn17.pypi-dependencies]
# The version value here needs to be exact, hence == instead of ~=
scikit-learn = "==1.7.dev0"
fairlearn = "*"
pandas = "*"
numpy = "*"
scipy = "*"

[tool.pixi.feature.lint.tasks]
lint = { cmd = "pre-commit install && pre-commit run -v --all-files --show-diff-on-failure" }

[tool.pixi.feature.tests.tasks]
tests = { cmd = "pytest -vsl --cov=skops --cov-report=xml --cov-report=term-missing -m \"not inference\" skops" }

[tool.pixi.environments]
default = ["docs", "tests", "lint", "rich", "dev", "sklearn17"]
lint = ["lint"]
docs = ["docs"]
ci-min-deps = ["rich", "tests", "lint", "min-deps"]
ci-sklearn11 = ["rich", "tests", "lint", "sklearn11"]
ci-sklearn12 = ["rich", "tests", "lint", "sklearn12"]
ci-sklearn13 = ["rich", "tests", "lint", "sklearn13"]
ci-sklearn14 = ["rich", "tests", "lint", "sklearn14"]
ci-sklearn15 = ["rich", "tests", "lint", "sklearn15"]
ci-sklearn16 = ["rich", "tests", "lint", "sklearn16"]
ci-sklearn17 = ["rich", "tests", "lint", "sklearn17"]

However, for the ci-sklearn11 case, eventhough I have this bit:

[tool.pixi.feature.sklearn11.dependencies]
scikit-learn = "~=1.1.0"
pandas = "~=1.4"
numpy = "~=1.22"
scipy = "~=1.8"
fairlearn = "~=0.7"
catboost = ">=1.0"
python = "=3.9"

when I get into the environment to check the scipy version, it's 1.13.1. This is probably coming from the fact that there are pypi as well as conda dpes, and the pypi deps seem to run after conda deps, and transiantly they override the scipy chosen by conda.

I don't see an easy way to debug these other than removing my lock file, disabling all envs except the one I'm interested in, and run a pixi -v command.

It'd be nicer if I could avoid that and nicely get deps resolution for an env, as well as having pypi and conda deps resolved together rather than one after another.

@ruben-arts
Copy link
Contributor

I believe this has to do with the ~= spec. e.g. ~=1.8 == >=1.8, 1.*". Thus allowing 1.13.1as a version. If you want1.8you can use~=1.8.0or1.8.*`

The request for easier debug is heard, we are thinking about a pixi lock command which could allow you to make simple "solves" per environment or platform.

We can't solve the two ecosystems together right now because of implementation details. This would be the holy grail, but is extremely difficult.

@adrinjalali
Copy link
Author

I guess solving the two together is something, solving one after another and detecting inconsistencies with explicitly specified constraints is another one, which is easier to achieve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants