Live data from Hacker News

Using uv with PyTorch

docs.astral.sh

21–30 of 56 posts

Re: Using uv with PyTorch

#21
I recently watched a talk by the author of uv that was surprisingly fascinating [1]. He goes into a few of the more notable hacks that they had to come up with to make it as fast as it is. The most interesting thing for me was that package resolution in python given constraints defined (eg. in requirements.txt) maps to a boolean satisfiability problem which is NP-complete. So uv uses a custom SAT solver to do this. I totally under-appreciated how much goes into this software and I'm bummed I have to use Poetry at work after having watched this talk.

[1] https://www.youtube.com/watch?v=gSKTfG1GXYQ

edit: NP-complete not NP-hard

Re: Using uv with PyTorch

#22
I was trying to figure out how to set up a pyproject with uv that could support cuda, rocm and other device types this morning, and next thing I knew, there was a new release adding pretty much exactly what I needed.

The pace of development on uv is really impressive.

Re: Using uv with PyTorch

#24

I was just getting used to pipenv and pyenv combo. Is this worth switching to?

I've been using a combination of pyenv, venv and Poetry in the past.

Now I have switched to uv with new projects. No problems so far. I definitely recommend giving it a go.

Re: Using uv with PyTorch

#26

So uv caused a bit of an issue with me installing PyTorch over the weekend. When installed with brew on my MacBook, uv currently has PyTorch 3.13 as a dependency, which is fine. But PyTorch does not currently have a stable wheel that's compatable with Python 3.13! This resulted in very confusing errors. (Solution was to point to the Nightly index) That's technically PyTorch's fault, but it's indicitave why a specific…

Fun fact: that's called out in the doc you're commenting :)

Re: Using uv with PyTorch

#27
post #19

Kind of an aside as this doc is about the complexities of installing particular PyTorch versions, but will say that uv is way faster at installing PyTorch than pip. We run internal benchmarks of our custom container image builder and in the 'install torch' benchmark the p50 time saved when using `uv` is 25 seconds! (71.4s vs. 43.74s) --- Aside 2: Seems there's a missing "involves" in this sentence: "As such, installi…

Joining your aside to tout the benefits of uv. We use uv combined with a simple proxy I wrote, to cache python dependencies, and then install them in parallel. UV also makes it simple to regenerate a requirements file and know who requires the dependencies, which in turn makes it easy to manage the ecosystem, analyze packages, and determine if we can reduce our footprint. Between that latter feature, the proxy, the p…

Is your caching proxy open source?

Re: Using uv with PyTorch

#28
post #19

Kind of an aside as this doc is about the complexities of installing particular PyTorch versions, but will say that uv is way faster at installing PyTorch than pip. We run internal benchmarks of our custom container image builder and in the 'install torch' benchmark the p50 time saved when using `uv` is 25 seconds! (71.4s vs. 43.74s) --- Aside 2: Seems there's a missing "involves" in this sentence: "As such, installi…

Joining your aside to tout the benefits of uv. We use uv combined with a simple proxy I wrote, to cache python dependencies, and then install them in parallel. UV also makes it simple to regenerate a requirements file and know who requires the dependencies, which in turn makes it easy to manage the ecosystem, analyze packages, and determine if we can reduce our footprint. Between that latter feature, the proxy, the p…

working on switching over a lot of our python usage to UV, seeing similar speedups in builds and local environments

Re: Using uv with PyTorch

#29

I was just getting used to pipenv and pyenv combo. Is this worth switching to?

I would also say absolutely. We've been using pipenv for ~6 years and have managed to build a pretty good workflow around it. But uv is just _so much faster_. So we've started moving everything over to uv and I don't think we'll ever look back.

Migrating is not super hard, we wrote a small script that moves all the information from a Pipfile to a pyproject.toml and it works like a charm.

Post reply on HN