astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.6k stars 466 forks source link

Make it so dependencies of packages can be overridden #1231

Closed tyree731 closed 2 months ago

tyree731 commented 2 months ago

When running rye sync -f -v on a project I'm converting to use rye, I run into this issue:

DEBUG Selecting: markupsafe==2.1.5 (MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_universal2.whl)
DEBUG Tried 14 versions: click 1, colorama 1, importlib-metadata 1, jinja2 1, markupsafe 1, pyyaml 1, rye 1, settingscascade 1, setuptools 1, sortedcontainers 1, toml 1, virtualenv 1, wheel 1, zipp 1
DEBUG Split  took 0.430s
DEBUG Installing in click==7.1.2, colorama==0.4.6, importlib-metadata==0.23, jinja2==2.10.3, markupsafe==2.1.5, pyyaml==5.4.1, rye==0.6.1, settingscascade==0.5.0, setuptools==70.3.0, sortedcontainers==2.1.0, toml==0.10.2, virtualenv==16.7.12, wheel==0.43.0, zipp==3.19.2 in /Users/styree/Library/Caches/uv/builds-v0/.tmp
8m9F1f
DEBUG Requirement already cached: click==7.1.2
DEBUG Requirement already cached: colorama==0.4.6
DEBUG Requirement already cached: importlib-metadata==0.23
DEBUG Requirement already cached: jinja2==2.10.3
DEBUG Requirement already cached: markupsafe==2.1.5
DEBUG Identified uncached requirement: pyyaml==5.4.1
DEBUG Requirement already cached: rye==0.6.1
DEBUG Requirement already cached: settingscascade==0.5.0
DEBUG Requirement already cached: setuptools==70.3.0
DEBUG Requirement already cached: sortedcontainers==2.1.0
DEBUG Requirement already cached: toml==0.10.2
DEBUG Requirement already cached: virtualenv==16.7.12
DEBUG Requirement already cached: wheel==0.43.0
DEBUG Requirement already cached: zipp==3.19.2
DEBUG Downloading and building requirement for build: pyyaml==5.4.1
DEBUG Acquired lock for `/Users/styree/Library/Caches/uv/built-wheels-v3/index/94f4e66d5b8d8f8a/pyyaml/5.4.1`
DEBUG Found fresh response for: http://.../simple/pyyaml/5.4.1/PyYAML-5.4.1.tar.gz#sha256=607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e
DEBUG Building: pyyaml==5.4.1
INFO Ignoring empty directory
DEBUG Solving with installed Python version: 3.11.4
DEBUG Adding direct dependency: setuptools*
DEBUG Adding direct dependency: wheel*
DEBUG Adding direct dependency: cython*
DEBUG Searching for a compatible version of setuptools (*)
DEBUG Selecting: setuptools==70.3.0 (setuptools-70.3.0-py3-none-any.whl)
DEBUG Searching for a compatible version of wheel (*)
DEBUG Selecting: wheel==0.43.0 (wheel-0.43.0-py3-none-any.whl)
DEBUG Searching for a compatible version of cython (*)
DEBUG Selecting: cython==3.0.10 (Cython-3.0.10-py2.py3-none-any.whl)
DEBUG Tried 3 versions: cython 1, setuptools 1, wheel 1
DEBUG Split  took 0.000s
DEBUG Installing in cython==3.0.10, setuptools==70.3.0, wheel==0.43.0 in /Users/styree/Library/Caches/uv/builds-v0/.tmp2mKYSS
DEBUG Requirement already cached: cython==3.0.10
DEBUG Requirement already cached: setuptools==70.3.0
DEBUG Requirement already cached: wheel==0.43.0
DEBUG Installing build requirements: cython==3.0.10, setuptools==70.3.0, wheel==0.43.0
DEBUG Calling `setuptools.build_meta.get_requires_for_build_wheel()`
error: Failed to prepare distributions
  Caused by: Failed to fetch wheel: pebble-ai @ file:///Users/styree/source/repos/...
  Caused by: Failed to build: `pebble-ai @ file:///Users/styree/source/repos/...`
  Caused by: Failed to install requirements from build-system.requires (install)
  Caused by: Failed to prepare distributions
  Caused by: Failed to fetch wheel: pyyaml==5.4.1
  Caused by: Failed to build: `pyyaml==5.4.1`
  Caused by: Build backend failed to determine extra requires with `build_wheel()` with exit status: 1
--- stdout:
running egg_info
writing lib3/PyYAML.egg-info/PKG-INFO
writing dependency_links to lib3/PyYAML.egg-info/dependency_links.txt
writing top-level names to lib3/PyYAML.egg-info/top_level.txt
--- stderr:
Traceback (most recent call last):
  File "<string>", line 14, in <module>
  File "/Users/styree/Library/Caches/uv/builds-v0/.tmp2mKYSS/lib/python3.11/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=[])

The issue seems to be with building pyyaml at a version that can reliably be built from source. This is something of a known issue, as rye itself had to work around the very same issue. To attempt the same workaround, I added pyyaml==6.0.1 to my pyproject.toml under dependencies, and I can confirm the lock file is seeing that dependency, but regardless the above issue occurs. I believe this is due to some package we use that is, even at the latest version, pulling in this bad version of pyyaml.

So this request is asking for some means of overriding the version pulled from a sub-dependency to be one which matches our version specifier, or both.

zanieb commented 2 months ago

Hi! This is a duplicate of #505 where I note a workaround to use uv's dependency override feature https://github.com/astral-sh/rye/issues/505#issuecomment-2183079323

tyree731 commented 2 months ago

Closing as duplicate here, and will add my use case into the other issue. Thanks!