astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
19.13k stars 561 forks source link

Advice on matching result from pip freeze with uv, e.g., search order ? #4008

Open buildqa opened 3 months ago

buildqa commented 3 months ago

I read some documentation that package repo search order can be changed with various args to uv. My question is that given we have always used (conventional) pip freeze to create a snapshot of the installed package revisions - then what is the recommended way to run freeze (or some other cammnd) with uv to at least try and achieve party with what pip reports? With no additional args, it looks like uv freeze reports tensorflow should be at the older revision 2.7.3 instead of the newer revision 2.13.1, but torch should be at the newer revision 2.3.0 instead of 2.1.2.

charliermarsh commented 3 months ago

Can you describe (in pip commands) the workflow you're trying to achieve? uv pip freeze just reports the currently installed versions in your environment.

buildqa commented 3 months ago

Sorry, I should start with the initial install - which is where the differences are first created.

We start off with a minimal python distribution (which now includes uv installed) to create a larger, custom python distribution with added site packages. We use requirements files to constrain only a few package revisions. Or the goal is to try and install the latest version of most packages. That works with the command, $ minimal_python3 -m pip install --upgrade --disable-pip-version-check -r requirements_1.txt -r requirements_2.txt

If that command is changed to use "uv pip install" instead of "pip install", and also when using uv append the argument "--python ", then we see differences like, --- built in pip installs --- keras 2.13.1 tensorflow 2.13.1 flatbuffers 24.3.25 fonttools 4.51.0 ... --- pip uv installs --- keras 2.7.0 tensorflow 2.7.0 flatbuffers 2.0.7 fonttools 4.52.4 ... It's not clear to me what extra args should be added to the uv command line to achieve results similar to pip.

buildqa commented 3 months ago

Forgot to list the argument to "--python" when using uv in the command above is the absolute path to minimal_python3