rye icon indicating copy to clipboard operation
rye copied to clipboard

force "incompatible" version

Open majidaldo opened this issue 2 years ago • 13 comments

Sometimes pip(?) refuses to install a package whose version I specify in pyproject.toml creates a supposed incompatibility. Is there a way to override this? As a workaround I manually update the requirements*.txt while not specifying a version in pyproject.toml.

majidaldo avatar Nov 28 '23 16:11 majidaldo

i too would like to this via pyproject.toml

ShravanSunder avatar Jun 21 '24 15:06 ShravanSunder

We support this over in uv now. I wonder if Rye supports it if you use the uv overrides syntax in your pyproject.toml?

zanieb avatar Jun 21 '24 15:06 zanieb

@zanieb i couldn't find any docs/notes on the overrides syntax in uv. how do you define them in pyproject.toml?

ShravanSunder avatar Jun 21 '24 16:06 ShravanSunder

Here's an example in our test suite https://github.com/astral-sh/uv/blob/b22ee82f0d3af607cc49d3f3870805769ea0b6e6/crates/uv/tests/pip_compile.rs#L3014-L3029

Basically:

[tool.uv]
override-dependencies = [
  "..."
]

zanieb avatar Jun 21 '24 16:06 zanieb

i tried it and still had problems, so perhaps there's something on rye side


[tool.uv]
override-dependencies = [
  "mosaic-widget>=0.9.0"
]
(askluna_py_agent_backend) ⚡➜ py-agent-backend (U feature/luna-257) rye sync    
Reusing already existing virtualenv
Generating production lockfile: /Users//Documents/dev/project-dev/askluna-project/askluna/requirements.lock
  × No solution found when resolving dependencies:
  ╰─▶ Because mosaic-widget==0.9.0 depends on duckdb==0.10.2 and
      only mosaic-widget<=0.9.0 is available, we can conclude that
      mosaic-widget>=0.9.0 depends on duckdb==0.10.2.
      And because you require duckdb>=1.0.0 and
      mosaic-widget>=0.9.0, we can conclude that the requirements
      are unsatisfiable.
error: could not write production lockfile for workspace

Caused by:
    Failed to run uv compile /var/folders/4f/697ggy6x26q8kh9qb2js4xnc0000gn/T/.tmphuVL7I/requirements.txt. uv exited with status: exit status: 1

ShravanSunder avatar Jun 21 '24 19:06 ShravanSunder

Sounds like the override was applied here though?

because you require duckdb>=1.0.0 and mosaic-widget>=0.9.0,

zanieb avatar Jun 21 '24 20:06 zanieb

i apologize, i assumed the override would force installation of that version despite the requirements being unsatisfied

ShravanSunder avatar Jun 21 '24 21:06 ShravanSunder

Nope the override allows you to change the required version of a package when it is specified by a dependency in your tree.

zanieb avatar Jun 21 '24 21:06 zanieb

interesting developments but i'll still keep it open as what we're looking for is to force install.

majidaldo avatar Jun 25 '24 18:06 majidaldo

Can you explain what the semantics of that would be?

charliermarsh avatar Jun 25 '24 18:06 charliermarsh

I can explain the usecase i had @charliermarsh

  • duckdb upgraded to v1 major (there's no actual change for compatibility)
  • one of the libs i'm using mosaic had <=0.9 requirement
  • there's a ticket to update in mosaic. in the mean time i wanted to just force a version of mosaic to install.

in pnpm its a bit like resolutions where certain versions are forced to install. not sure if there's a concept of that in python managers.

ShravanSunder avatar Jun 26 '24 13:06 ShravanSunder

Adding my use case from https://github.com/astral-sh/rye/issues/1231 here, there are a set of pyyaml which are seemingly incompatible with rye, as evidenced by this rye PR, and some dependencies of ours pull in one of those versions.

tyree731 avatar Jul 15 '24 17:07 tyree731