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

uv resolves to older numba version incompatible with python version #8863

Closed
MitchellAcoustics opened this issue Nov 6, 2024 · 8 comments
Closed
Labels
duplicate This issue or pull request already exists

Comments

@MitchellAcoustics
Copy link

MitchellAcoustics commented Nov 6, 2024

When attempting to add a new dependency to a fresh env which depends on numba, it fails to install with:

# uv 0.4.28 (debe67ffd 2024-10-28)
# ./.python-version 3.12
uv cache clean
uv add scikit-maad
DEBUG Downloading source distribution: numba==0.53.1
DEBUG Traceback (most recent call last):
DEBUG   File "<string>", line 14, in <module>
DEBUG   File "/Users/mitch/.cache/uv/builds-v0/.tmp6ZFD4B/lib/python3.12/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
DEBUG     return self._get_build_requires(config_settings, requirements=[])
DEBUG            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
DEBUG   File "/Users/mitch/.cache/uv/builds-v0/.tmp6ZFD4B/lib/python3.12/site-packages/setuptools/build_meta.py", line 303, in _get_build_requires
DEBUG     self.run_setup()
DEBUG   File "/Users/mitch/.cache/uv/builds-v0/.tmp6ZFD4B/lib/python3.12/site-packages/setuptools/build_meta.py", line 521, in run_setup
DEBUG     super().run_setup(setup_script=setup_script)
DEBUG   File "/Users/mitch/.cache/uv/builds-v0/.tmp6ZFD4B/lib/python3.12/site-packages/setuptools/build_meta.py", line 319, in run_setup
DEBUG     exec(code, locals())
DEBUG   File "<string>", line 55, in <module>
DEBUG   File "<string>", line 52, in _guard_py_ver
DEBUG RuntimeError: Cannot install on Python version 3.12.5; only versions >=3.6,<3.10 are supported.
DEBUG Released lock at `/Users/mitch/.cache/uv/sdists-v5/pypi/llvmlite/0.36.0/.lock`
DEBUG Released lock at `/Users/mitch/.cache/uv/sdists-v5/pypi/numba/0.53.1/.lock`
error: Failed to prepare distributions
  Caused by: Failed to download and build `llvmlite==0.36.0`
  Caused by: Build backend failed to determine requirements with `build_wheel()` (exit status: 1)

[stderr]
Traceback (most recent call last):
  File "<string>", line 14, in <module>
  File "/Users/mitch/.cache/uv/builds-v0/.tmp6ZFD4B/lib/python3.12/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=[])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mitch/.cache/uv/builds-v0/.tmp6ZFD4B/lib/python3.12/site-packages/setuptools/build_meta.py", line 303, in _get_build_requires
    self.run_setup()
  File "/Users/mitch/.cache/uv/builds-v0/.tmp6ZFD4B/lib/python3.12/site-packages/setuptools/build_meta.py", line 521, in run_setup
    super().run_setup(setup_script=setup_script)
  File "/Users/mitch/.cache/uv/builds-v0/.tmp6ZFD4B/lib/python3.12/site-packages/setuptools/build_meta.py", line 319, in run_setup
    exec(code, locals())
  File "<string>", line 55, in <module>
  File "<string>", line 52, in _guard_py_ver
RuntimeError: Cannot install on Python version 3.12.5; only versions >=3.6,<3.10 are supported.

In my case, I am trying to install scikit-maad, which (as of v1.4.3) depends on resampy >=0.4 -> numba>=0.53. From a fresh venv with uv cache cleared, this resolves to v0.53.1 with

DEBUG Searching for a compatible version of numba (>=0.53)
DEBUG Selecting: numba==0.53.1 [preference] (numba-0.53.1.tar.gz)

However, numba v0.53.1 is incompatible with my pinned python v3.12:

# from https://github.com/numba/numba/blob/0.53.1/setup.py
min_python_version = "3.6"
max_python_version = "3.10"  # exclusive

I would expect that uv would handle this when resolving - recognise numba 0.53.1 is not compatible with python 3.12 and find a newer version which is, since higher versions are allowed by both resampy and scikit-maad. I'm not sure why it considers 0.53.1 'preferred'?

I can confirm it's not an actual dependency conflict - clearing uv cache and doing uv add numba first (which sets the dependency to the latest numba>=0.60.0), then uv add scikit-maad installs everything fine.

@MitchellAcoustics
Copy link
Author

Just to be extra sure, I just updated uv to v0.4.30 and still get the same.

@zanieb
Copy link
Member

zanieb commented Nov 6, 2024

Probably a duplicate of #8157

@charliermarsh
Copy link
Member

Yeah, there's an extensive write-up on this here: #6281 (comment)

@charliermarsh charliermarsh closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2024
@zanieb zanieb added the duplicate This issue or pull request already exists label Nov 6, 2024
@MitchellAcoustics
Copy link
Author

Thanks! I saw those other discussions, what I'm confused by is why the Python version constraints are not respected. My assumption would be numba 0.53 wouldn't even be considered because of its python constraints, rather than the other dependency constraints.

@charliermarsh
Copy link
Member

Are you referring to the RuntimeError: Cannot install on Python version 3.12.5; only versions >=3.6,<3.10 are supported. error?

@MitchellAcoustics
Copy link
Author

MitchellAcoustics commented Nov 6, 2024

Somewhat, but that happens when trying to install llvmlite. My impression would be that numba v0.53.1 shouldn't even be a candidate for resolving since it places an upper bound on the python version, which is then what leads to that error happening. I'm not sure when they started supporting python 3.12, but I would assume that's where the resolution would then start looking for a version compatible with the other dependencies and v0.53 wouldn't be considered. That said, I don't know anything about how dependency resolution works, so I could have an incorrect understanding!

# from https://github.com/numba/numba/blob/0.53.1/setup.py
min_python_version = "3.6"
max_python_version = "3.10"  # exclusive

@charliermarsh
Copy link
Member

Yeah, we don't respect upper-bounds on requires-python. Our stance is that requires-python is intended to indicate minimum Python version compatibility. There's a lot of discussion around that elsewhere -- here's one reference that links to a few more: #4022 (comment)

@MitchellAcoustics
Copy link
Author

Thank you, that's very helpful! Now that I think about it, that sort of explicit upper bounding was exactly one of the issues I had with poetry and why I stopped using it even before uv came around.

I suppose I'll just set my own numba version dependency in my package, although it feels like there's a more elegant solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants