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

Regression in solving behaviour? #1917

Closed
2 tasks done
znichollscr opened this issue Aug 26, 2024 · 5 comments
Closed
2 tasks done

Regression in solving behaviour? #1917

znichollscr opened this issue Aug 26, 2024 · 5 comments
Labels
🐞 bug Something isn't working

Comments

@znichollscr
Copy link

znichollscr commented Aug 26, 2024

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

Take the following pyproject.toml file, which comes from here

pyproject.toml file

There are probably keys that aren't relevant in here, but for completeness I've included it all

[project]
authors = [
    { name = "Zebedee Nicholls", email = "[email protected]" },
]
requires-python = ">=3.9"
dependencies = [
    "scitools-iris>=3.0",
    "netcdf4>=1.0",
    "numpy<2.0",
    "cfchecker>=4.1.0",
    "cftime",
    "attrs",
    "cattrs",
    "cf-xarray",
    "loguru",
    "ncdata",
    "pandas",
    "pint",
    "pint-xarray",
    "pooch",
    "tqdm",
    "typer",
    "typing-extensions",
    "validators",
    "xarray",
]
name = "input4mips-validation"
version = "0.11.6a1"
description = "Validation of input4MIPs data (checking file formats, metadata etc.)."
readme = "README.md"

[project.license]
text = "BSD-3-Clause"

[project.optional-dependencies]
loguru-config = [
    "loguru-config",
]
dev = [
    "pre-commit>=3.7.1",
    "mypy>=1.10.1",
    "towncrier>=23.11.0,<24",
    "packaging>=24.1.0",
    "pandas-stubs>=2.2.2.240603",
    "tomli>=2.0.1",
    "types-tqdm>=4.66.0.20240417",
]
docs = [
    "mkdocs>=1.6.0",
    "mkdocstrings[python]>=0.25.0",
    "mkdocs-material>=9.5.0",
    "mkdocs-gen-files>=0.5.0",
    "mkdocs-literate-nav>=0.6.1",
    "mkdocs-section-index>=0.3.9",
    "mkdocs-autorefs>=1.0.1",
    "mkdocs-jupyter>=0.24.0",
    "myst-nb>=1.1.1",
    "jupyterlab>=4.2.0",
    "jupytext>=1.16.3",
]
notebooks = [
    "jupyterlab>=4.2.0",
    "jupytext>=1.16.3",
]
tests = [
    "pytest>=8.2.2",
    "coverage>=7.6.0",
    "pytest-cov>=5.0.0",
]

[project.scripts]
input4mips-validation = "input4mips_validation.cli:app"

[tool.pixi.feature.py39.dependencies]
python = "3.9.*"

[tool.pixi.feature.py310.dependencies]
python = "3.10.*"

[tool.pixi.feature.py311.dependencies]
python = "3.11.*"

[tool.pixi.environments.default]
features = [
    "py39",
]

[tool.pixi.environments.docs]
features = [
    "docs",
]
solve-group = "default"

[tool.pixi.environments.all-dev]
features = [
    "loguru-config",
    "dev",
    "docs",
    "notebooks",
    "tests",
]
solve-group = "default"

[tool.pixi.environments.py39]
features = [
    "py39",
]
solve-group = "default"

[tool.pixi.environments.py310]
features = [
    "py310",
]

[tool.pixi.environments.py311]
features = [
    "py311",
]

[tool.pixi.environments.test-py39]
features = [
    "tests",
]
solve-group = "default"

[tool.pixi.environments.test-py310]
features = [
    "tests",
    "py310",
]

[tool.pixi.environments.test-py311]
features = [
    "tests",
    "py311",
]

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

[tool.pixi.pypi-dependencies.input4mips_validation]
path = "."
editable = true

[tool.pixi.tasks]

[tool.pixi.dependencies]
cfchecker = ">=4.1.0"
cftime = ">=1.0"
iris = ">=3.0"
netcdf4 = ">=1.0"
numpy = "<2.0"

[tool.pdm.build]
locked = true
includes = [
    "src/input4mips_validation",
    "LICENCE",
]

[tool.coverage.run]
source = [
    "src",
]
branch = true

[tool.coverage.report]
fail_under = 70
skip_empty = true
show_missing = true
exclude_also = [
    "if TYPE_CHECKING",
]

[tool.mypy]
strict = true
disallow_any_unimported = true
show_error_codes = true
show_error_context = true
warn_unreachable = true
follow_imports = "normal"

[tool.jupytext]
formats = "ipynb,py:percent"

[tool.pytest.ini_options]
addopts = [
    "--import-mode=importlib",
]

[tool.ruff]
src = [
    "src",
]
target-version = "py39"
line-length = 88

[tool.ruff.lint]
select = [
    "E",
    "W",
    "F",
    "I",
    "D",
    "PL",
    "TRY",
    "NPY",
    "RUF",
    "UP",
    "S",
]
unfixable = [
    "PD002",
]
ignore = [
    "D200",
    "D400",
    "UP007",
]

[tool.ruff.lint.per-file-ignores]
"test*.py" = [
    "D",
    "S101",
    "PLR2004",
]
"docs/*" = [
    "D100",
    "E402",
    "S101",
]
"scripts/*" = [
    "S101",
]
"stubs/*" = [
    "PLR0913",
]

[tool.ruff.lint.isort]
known-first-party = [
    "src",
]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.format]
docstring-code-format = true

[tool.towncrier]
package = "input4mips_validation"
package_dir = "src"
filename = "docs/changelog.md"
directory = "changelog/"
title_format = "## input4mips-validation {version} ({project_date})"
underlines = [
    "",
    "",
    "",
]
issue_format = "[#{issue}](https://github.com/climate-resource/input4mips_validation/pulls/{issue})"
type = [
    { directory = "breaking", name = "⚠️ Breaking Changes", showcontent = true },
    { directory = "deprecation", name = "🗑️ Deprecations", showcontent = true },
    { directory = "feature", name = "🆕 Features", showcontent = true },
    { directory = "improvement", name = "🎉 Improvements", showcontent = true },
    { directory = "fix", name = "🐛 Bug Fixes", showcontent = true },
    { directory = "docs", name = "📚 Improved Documentation", showcontent = true },
    { directory = "trivial", name = "🔧 Trivial/Internal Changes", showcontent = false },
]

[tool.liccheck]
authorized_licenses = [
    "bsd",
    "bsd license",
    "BSD 3-Clause",
    "CC0",
    "apache",
    "apache 2.0",
    "apache software",
    "apache software license",
    "Apache License, Version 2.0",
    "Historical Permission Notice and Disclaimer (HPND)",
    "isc license",
    "isc license (iscl)",
    "gnu lgpl",
    "lgpl with exceptions or zpl",
    "LGPLv2+",
    "GNU Lesser General Public License v2 (LGPLv2)",
    "GNU Lesser General Public License v2 or later (LGPLv2+)",
    "mit",
    "mit license",
    "Mozilla Public License 2.0 (MPL 2.0)",
    "python software foundation",
    "python software foundation license",
    "zpl 2.1",
]
unauthorized_licenses = [
    "agpl",
    "gnu agpl",
    "gpl v3",
    "gplv3",
    "gpl v2",
    "gplv2",
    "gpl v1",
    "gplv1",
]

[build-system]
requires = [
    "pdm-backend",
    "pdm-build-locked",
]
build-backend = "pdm.backend"

With pixi 0.26.1, the solving passes

pixi 0.26.1 output
$ pixi --version
pixi 0.26.1
$ pixi install -e all-dev
✔ The all-dev environment has been installed.

With pixi 0.27.0, the solving fails

pixi 0.27.0 output
$ pixi --version
pixi 0.27.0
$ pixi install -e all-dev
  ⠒ default:linux-64     [00:00:02] resolving conda
  ⠒ default:osx-64       [00:00:02] resolving conda
  ⠒ default:win-64       [00:00:02] resolving conda
  ⠒ default:linux-aarch6400:00:02] resolving conda
  ⠒ py310:win-64         [00:00:02] resolving conda
  ⠒ py310:linux-aarch64  [00:00:02] resolving conda
  ⠂ py310:osx-64         [00:00:00] resolving conda
  ⠉ default:osx-arm64    [00:00:00] resolving conda                                                                                                                                 × failed to solve the pypi requirements of 'default' 'osx-arm64'
  ├─▶ failed to resolve pypi dependencies
  ╰─▶ Because virtualenv>=20.24.7 depends on platformdirs>=3.9.1,<5 and platformdirs>=3.9.1,<4, we can conclude that virtualenv>=20.24.2 depends on platformdirs>=3.9.1,<5.
      And because virtualenv>=20.23.1,<=20.24.1 depends on platformdirs>=3.5.1,<4 and platformdirs>=3.2,<4, we can conclude that virtualenv>=20.22.0 depends on
      platformdirs>=3.2,<5.
      And because virtualenv>=20.19.0,<=20.21.1 depends on platformdirs>=2.4,<4 and platformdirs>=2.4,<3, we can conclude that virtualenv>=20.16.3 depends on
      platformdirs>=2.4,<5.
      And because virtualenv>=20.10.0,<=20.16.2 depends on platformdirs>=2,<3 and platformdirs==72.2.0, we can conclude that virtualenv>=20.10.0 cannot be used.
      And because only the following versions of virtualenv are available:
          virtualenv<=20.10.0
          virtualenv==20.11.0
          virtualenv==20.11.1
          virtualenv==20.11.2
          virtualenv==20.12.0
          virtualenv==20.12.1
          virtualenv==20.13.0
          virtualenv==20.13.1
          virtualenv==20.13.2
          virtualenv==20.13.3
          virtualenv==20.13.4
          virtualenv==20.14.0
          virtualenv==20.14.1
          virtualenv==20.15.0
          virtualenv==20.15.1
          virtualenv==20.16.0
          virtualenv==20.16.1
          virtualenv==20.16.2
          virtualenv==20.16.3
          virtualenv==20.16.4
          virtualenv==20.16.5
          virtualenv==20.16.6
          virtualenv==20.16.7
          virtualenv==20.17.0
          virtualenv==20.17.1
          virtualenv==20.18.0
          virtualenv==20.19.0
          virtualenv==20.20.0
          virtualenv==20.21.0
          virtualenv==20.21.1
          virtualenv==20.22.0
          virtualenv==20.23.0
          virtualenv==20.23.1
          virtualenv==20.24.0
          virtualenv==20.24.1
          virtualenv==20.24.2
          virtualenv==20.24.3
          virtualenv==20.24.4
          virtualenv==20.24.5
          virtualenv==20.24.6
          virtualenv==20.24.7
          virtualenv==20.25.0
          virtualenv==20.25.1
          virtualenv==20.25.2
          virtualenv==20.25.3
          virtualenv==20.26.0
          virtualenv==20.26.1
          virtualenv==20.26.2
          virtualenv==20.26.3
      and pre-commit>=3.7.1 depends on virtualenv>=20.10.0, we can conclude that pre-commit>=3.7.1 cannot be used.
      And because only the following versions of pre-commit are available:
          pre-commit<=3.7.1
          pre-commit==3.8.0
      and you require pre-commit>=3.7.1, we can conclude that the requirements are unsatisfiable.

With pixi 0.28.1 (latest at the time of writing), the solving also fails

pixi 0.28.1 output
$ pixi --version
pixi 0.28.1
$ pixi install -e all-dev
  ⠂ default:linux-64     [00:00:12] resolving conda
  ⠂ default:win-64       [00:00:12] resolving conda
  ⠄ py310:linux-64       [00:00:10] resolving conda
  ⠄ py310:win-64         [00:00:07] resolving conda
  ⠤ test-py310:linux-64  [00:00:04] resolving conda
  ⠂ test-py310:win-64    [00:00:00] resolving conda
  ⠙ test-py311:osx-arm64 [00:00:00] resolving conda
  ⠁ test-py311:linux-aarch64 [00:00:00] loading repodata                                                                                                                            × failed to solve the pypi requirements of 'default' 'linux-aarch64'
  ├─▶ failed to resolve pypi dependencies
  ╰─▶ Because virtualenv>=20.24.7 depends on platformdirs>=3.9.1,<5 and platformdirs>=3.9.1,<4, we can conclude that virtualenv>=20.24.2 depends on platformdirs>=3.9.1,<5.
      And because virtualenv>=20.23.1,<=20.24.1 depends on platformdirs>=3.5.1,<4 and platformdirs>=3.2,<4, we can conclude that virtualenv>=20.22.0 depends on
      platformdirs>=3.2,<5.
      And because virtualenv>=20.19.0,<=20.21.1 depends on platformdirs>=2.4,<4 and platformdirs>=2.4,<3, we can conclude that virtualenv>=20.16.3 depends on
      platformdirs>=2.4,<5.
      And because virtualenv>=20.10.0,<=20.16.2 depends on platformdirs>=2,<3 and platformdirs==72.2.0, we can conclude that virtualenv>=20.10.0 cannot be used.
      And because only the following versions of virtualenv are available:
          virtualenv<=20.10.0
          virtualenv==20.11.0
          virtualenv==20.11.1
          virtualenv==20.11.2
          virtualenv==20.12.0
          virtualenv==20.12.1
          virtualenv==20.13.0
          virtualenv==20.13.1
          virtualenv==20.13.2
          virtualenv==20.13.3
          virtualenv==20.13.4
          virtualenv==20.14.0
          virtualenv==20.14.1
          virtualenv==20.15.0
          virtualenv==20.15.1
          virtualenv==20.16.0
          virtualenv==20.16.1
          virtualenv==20.16.2
          virtualenv==20.16.3
          virtualenv==20.16.4
          virtualenv==20.16.5
          virtualenv==20.16.6
          virtualenv==20.16.7
          virtualenv==20.17.0
          virtualenv==20.17.1
          virtualenv==20.18.0
          virtualenv==20.19.0
          virtualenv==20.20.0
          virtualenv==20.21.0
          virtualenv==20.21.1
          virtualenv==20.22.0
          virtualenv==20.23.0
          virtualenv==20.23.1
          virtualenv==20.24.0
          virtualenv==20.24.1
          virtualenv==20.24.2
          virtualenv==20.24.3
          virtualenv==20.24.4
          virtualenv==20.24.5
          virtualenv==20.24.6
          virtualenv==20.24.7
          virtualenv==20.25.0
          virtualenv==20.25.1
          virtualenv==20.25.2
          virtualenv==20.25.3
          virtualenv==20.26.0
          virtualenv==20.26.1
          virtualenv==20.26.2
  ⠂ default:linux-64     [00:00:12] resolving conda
  ⠂ default:win-64       [00:00:12] resolving conda
  ⠄ py310:linux-64       [00:00:10] resolving conda
  ⠄ py310:win-64         [00:00:07] resolving conda
  ⠤ test-py310:linux-64  [00:00:04] resolving conda
  ⠂ test-py310:win-64    [00:00:00] resolving conda
  ⠙ test-py311:osx-arm64 [00:00:00] resolving conda
  ⠁ test-py311:linux-aarch64 [00:00:00] resolving conda

Issue description

Thanks for all your work on pixi, it's an amazing tool.

All the details are in the above, but as a shorter summary. My pyproject.toml installs fine (with e.g. pixi install -e all-dev) with pixi 0.26.1. However, with 0.27.0 and 0.28.1 (latest at the time of writing), the solving fails.

As far as I can tell, pixi (or perhaps UV under the hood) isn't correctly handling the version of platformdirs. One of the lines in the output is, And because virtualenv>=20.10.0,<=20.16.2 depends on platformdirs>=2,<3 and platformdirs==72.2.0, we can conclude that virtualenv>=20.10.0 cannot be used, which doesn't make sense to me because there is no platformdirs 72.2.0 anywhere (neither in the pyproject.toml file nor on PyPI).

This may be releated to make #1295.

Expected behavior

I expected this to solve, even with the newer versions of pixi. This seems like a regression to me, but it is possible that I am missing something (if so, apologies and thanks for helping out).

@znichollscr znichollscr added the 🐞 bug Something isn't working label Aug 26, 2024
@pablovela5620
Copy link
Contributor

I'm experiencing a similar issue. I used to be able to install the spaces pypi package, now I have a very similar error as described by @znichollscr. The only thing is downgrading to 0.25.0 doesn't seem to fix the issue for me

The following pyproject.toml reproduces the issue

[project]
name = "test-spaces"
version = "0.1.0"
description = "test hf spaces"
requires-python = ">=3.10.0"
readme = "README.md"

dependencies = []

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64"]


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

[tool.pixi.dependencies]
pip = ">=24.2,<25"

[tool.ruff]
ignore = [
    "F722", # Forward annotation false positive from jaxtyping. Should be caught by pyright.
]

doing pixi add spaces --pypi results in the following error

Full error
 pixi add spaces --pypi
  × failed to solve the pypi requirements of 'default' 'linux-64'
  ├─▶ failed to resolve pypi dependencies
  ╰─▶ Because any of:
          spaces<=0.3.0
          spaces>=0.6.0,<=0.8.0
          spaces>=0.9.0,<=0.9.1
          spaces==0.10.0
      depends on typing-extensions>=4.5.0,<5.0.0 and typing-extensions==72.2.0, we can conclude that any of:
          spaces<=0.3.0
          spaces>=0.6.0,<=0.8.0
          spaces>=0.9.0,<=0.9.1
          spaces==0.10.0
       cannot be used.
      And because only the following versions of spaces are available:
          spaces<=0.3.0
          spaces>=0.6.0,<=0.8.0
          spaces>=0.9.0,<=0.9.1
          spaces==0.10.0
          spaces==0.11.0
          spaces==0.12.0
          spaces==0.13.0
          spaces==0.14.0
          spaces==0.15.0
          spaces>=0.16.0,<=0.16.2
          spaces>=0.16.3,<=0.23.2
          spaces>=0.24.0,<=0.28.3
          spaces>=0.29.0
      we can conclude that any of:
          spaces<0.11.0
          spaces>0.11.0,<0.12.0
          spaces>0.12.0,<0.13.0
          spaces>0.13.0,<0.14.0
          spaces>0.14.0,<0.15.0
          spaces>0.15.0,<0.16.0
          spaces>0.16.2,<0.16.3
          spaces>0.23.2,<0.24.0
          spaces>0.28.3,<0.29.0
       cannot be used. (1)
      
      Because any of:
          spaces==0.11.0
          spaces==0.12.0
          spaces==0.13.0
          spaces==0.14.0
          spaces==0.15.0
          spaces>=0.16.0,<=0.16.2
          spaces>=0.16.3,<=0.23.2
          spaces>=0.24.0,<=0.28.3
          spaces>=0.29.0
      depends on typing-extensions>=4,<5 and typing-extensions==72.2.0, we can conclude that any of:
          spaces==0.11.0
          spaces==0.12.0
          spaces==0.13.0
          spaces==0.14.0
          spaces==0.15.0
          spaces>=0.16.0,<=0.16.2
          spaces>=0.16.3,<=0.23.2
          spaces>=0.24.0,<=0.28.3
          spaces>=0.29.0
       cannot be used.
      And because we know from (1) that any of:
          spaces<0.11.0
          spaces>0.11.0,<0.12.0
          spaces>0.12.0,<0.13.0
          spaces>0.13.0,<0.14.0
          spaces>0.14.0,<0.15.0
          spaces>0.15.0,<0.16.0
          spaces>0.16.2,<0.16.3
          spaces>0.23.2,<0.24.0
          spaces>0.28.3,<0.29.0
       cannot be used, we can conclude that all versions of spaces cannot be used.
      And because you require spaces, we can conclude that the requirements are unsatisfiable.
      
      hint: Pre-releases are available for spaces in the requested range (e.g., 0.29b7), but pre-releases weren't enabled (try:
      `--prerelease=allow`)

The important bit being

depends on typing-extensions>=4.5.0,<5.0.0 and typing-extensions==72.2.0, we can conclude that any of:

which like mentioned, doesn't make sense because there is not typing-extensions==72.2.0 it seems like in my case its typing-extensions that's blocking things. I also notice that if I don't include, things resolve fine.

@tdejager
Copy link
Contributor

tdejager commented Aug 27, 2024

Hi @pablovela5620 and @znichollscr, I haven't looked at @znichollscr issue yet, but I'm kinda guessing its the same as @pablovela5620. It seems that our mapping is returning the incorrect mapping for setuptools. Where it incorrectly assumes its the same as the packages: typing-extension among many others.

jaraco-functools 72.2.0, zipp 72.2.0, importlib-resources 72.2.0, jaraco-context 72.2.0, packaging 72.2.0, tomli 72.2.0, inflect 72.2.0, wheel 72.2.0, autocommand 72.2.0, jaraco-text 72.2.0, ordered-set 72.2.0, setuptools 72.2.0, backports-tarfile 72.2.0, typeguard 72.2.0, typing-extensions 72.2.0, pip 24.2, more-itertools 72.2.0, platformdirs 72.2.0, importlib-metadata 72.2.0

As you can see these are all 72.2.0 versions which is a setuptool version. So this is definitely a bug, I don't know why this is happening, (cc @nichmor) is more versed in the mapping. However, most of the team is attending EuroSciPy (and currently travelling), so I'll take a look later as well.

@nichmor
Copy link
Contributor

nichmor commented Aug 27, 2024

hey! the bug was found - we extract mapping names also from site-packages/_vendor folder from setuptools which produces a wrong result ( as it can be seen here: https://conda-mapping.prefix.dev/hash-v0/0252f6570de8ff29d489958fc7826677a518061b1aa5e1828a427eec8a7928a4 ).

I'm working on the fix which will be soon available

@tdejager
Copy link
Contributor

I've tested both projects and they seem to work again for me, closing this issue, feel free to re-open if issue persists.

@znichollscr
Copy link
Author

Can confirm this has fixed my issue: climate-resource/input4mips_validation#67

Thanks for such a fast turnaround 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants
@tdejager @nichmor @pablovela5620 @znichollscr and others