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

Can't specify per-dependency package index / can't specify uv behavior in config file #1210

Open
kjabon opened this issue Jul 9, 2024 · 8 comments

Comments

@kjabon
Copy link

kjabon commented Jul 9, 2024

Steps to Reproduce

  1. rye init
  2. add to pyproject.toml, to get access to pytorch:
[[tool.rye.sources]]
name = "pytorch"
url = "https://download.pytorch.org/whl/cpu"
  1. rye add pytorch (optional to reproduce, but necessary for my project)
  2. rye add requests>=2.30.0

Expected Result

A successful install of the desired requests version, while also being able to install pytorch.

Actual Result

× No solution found when resolving dependencies:
╰─▶ Because only requests<2.30.0 is available and you require requests>=2.30.0, we can
conclude that the requirements are unsatisfiable.

Version Info

rye 0.36.0
commit: 0.36.0 (12c024c 2024-07-07)
platform: linux (x86_64)
self-python: cpython@3.12.3
symlink support: true
uv enabled: true

Stacktrace

Stack backtrace:
0: anyhow::error::::msg
1: rye::lock::generate_lockfile
2: rye::lock::update_single_project_lockfile
3: rye::sync::sync
4: rye::cli::sync::execute
5: rye::cli::execute
6: std::panicking::try
7: rye::utils::panic::trap_bad_pipe
8: rye::main
9: std::sys_common::backtrace::__rust_begin_short_backtrace
10: std::rt::lang_start::{{closure}}
11: std::rt::lang_start_internal
12: main

@kjabon
Copy link
Author

kjabon commented Jul 9, 2024

Since pytorch needs to grab from their server and not pypi, we need to add that source. However, since the pytorch source has an older version of requests (~2.28), and rye is using uv, it grabs the pytorch version of requests and gives up looking for a satisfactory version, without checking the pypi repo. As described here.

The promise of rye/uv seems heaven-sent, and is worth the switch. But... falling back to rye/pip-tools for compatibility isn't appealing enough to make rye worth the switch from my existing workflow (mamba/conda).

So, implementing dependency-specific packages in rye would be great!

@kjabon kjabon changed the title Can't specify specific package index Can't specify per-dependency package index / can't specify uv behavior in config file Jul 9, 2024
@charliermarsh
Copy link
Member

We could expose uv’s index strategy argument in Rye, which would let you opt-in to a strategy that works here. Would that work?

@kjabon
Copy link
Author

kjabon commented Jul 9, 2024

That would work!

Separate note, I see it's suggested here that uv hopes to swallow rye's higher-level functionality, eventually, so I guess these sorts of bugs/features are maybe a temporary bandaid until that happens? Looking forward to it.

@mbronckers
Copy link

That would be great @charliermarsh !

@knl
Copy link

knl commented Jul 11, 2024

Having this would be great. I stumbled upon this issue when I tried to install an internal package. We have two internal indexes, and one package (in prod index) depends on another internal package (on dev index). rye add internal-pkg-foo was failing with uv claiming it can't find the other package. It started working after I set UV_INDEX_STRATEGY="unsafe-best-match".

@Maxi91f
Copy link

Maxi91f commented Aug 1, 2024

We are having the same problem here. We want to install pytorch+cpu but adding

[[tool.rye.sources]]
name = "pytorch"
url = "https://download.pytorch.org/whl/cpu"

makes some conflicts on versions on another packages dependencies, as pytorch server is outdated.

Setting UV_INDEX_STRATEGY="unsafe-best-match" fixes it, thanks @knl .

But implementing dependency-specific packages is something we were using in pipenv. The hard thing is to find a way to define this and being PEP 508 compliant.

@charliermarsh
Copy link
Member

We plan to support that kind of "index pinning" in uv eventually (though you're right that it can't be expressed purely in PEP 508 terms).

@JonZeolla
Copy link

I believe this is the correct uv issue to track: astral-sh/uv#171

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

6 participants