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

Platform-Specific Dependencies in requirements.in Not Working as Expected with --universal #8915

Closed
ewianda opened this issue Nov 8, 2024 · 3 comments · Fixed by #8960
Closed
Assignees
Labels
bug Something isn't working

Comments

@ewianda
Copy link

ewianda commented Nov 8, 2024

Description:
When specifying platform-specific dependencies in requirements.in for optimum[onnxruntime] and optimum[onnxruntime-gpu], the generated requirements.txt file consolidates dependencies inappropriately. Specifically, optimum[onnxruntime-gpu]; sys_platform == 'linux' and optimum[onnxruntime]; sys_platform == 'darwin' results in optimum[onnxruntime,onnxruntime]==1.18; sys_platform == 'linux' in the output requirements.txt, which causes the Darwin platform dependency to be ignored.

Steps to Reproduce:

  1. Create a requirements.in file with the following lines:
    optimum[onnxruntime-gpu]; sys_platform == 'linux'
    optimum[onnxruntime]; sys_platform == 'darwin'
    
  2. Run uv pip compile --universal requirements.in to generate requirements.txt.
  3. Open the resulting requirements.txt.

Expected Behavior:
requirements.txt should list both platform-specific dependencies separately, like:

optimum[onnxruntime-gpu]==1.18; sys_platform == 'linux'
optimum[onnxruntime]==1.18; sys_platform == 'darwin'

Actual Behavior:
The generated requirements.txt incorrectly merges dependencies, resulting in:

optimum[onnxruntime,onnxruntime-gpu]==1.18; sys_platform == 'linux'

This line omits the macOS (Darwin) dependency entirely.

Environment:

  • uv version: 0.4.30

  • Operating System: Linux

@charliermarsh charliermarsh added the bug Something isn't working label Nov 8, 2024
@charliermarsh
Copy link
Member

I can guess at what's going on here, thanks.

@charliermarsh charliermarsh self-assigned this Nov 8, 2024
konstin pushed a commit that referenced this issue Nov 10, 2024
## Summary

We were making some incorrect assumptions in the extra-merging code for
universal `pip compile`. This PR corrects those assumptions and adds a
bunch of additional tests.

Closes #8915.
@ewianda
Copy link
Author

ewianda commented Nov 12, 2024

Hi @charliermarsh , I just tested the fix, and it works, but for one anomaly.

 echo -e "optimum[onnxruntime]; sys_platform == 'darwin'\noptimum[onnxruntime-gpu]; sys_platform == 'linux'" | cargo run --  pip compile --universal --no-strip-extras  - | grep optimum
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.34s
     Running `target/debug/uv pip compile --universal --no-strip-extras -`
 
optimum==1.23.3 ; sys_platform == 'darwin' or sys_platform == 'linux'
optimum[onnxruntime]==1.23.3 ; sys_platform == 'darwin'
optimum[onnxruntime-gpu]==1.23.3 ; sys_platform == 'linux'  

The extra optimum==1.23.3 ; sys_platform == 'darwin' or sys_platform == 'linux' seems unnecessary

@charliermarsh
Copy link
Member

I saw that, but I think it's acceptable personally.

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

Successfully merging a pull request may close this issue.

2 participants