Earlier quoted context omitted.
I generally agree but one thing I find very frustrating (i.e. have not figured out yet) is how deal with extras well, particularly with pytorch. Some of my machines have GPU, some don't and things like "uv add" end up uninstalling everything and installing the opposite forcing a resync with the appropriate --extra tag. The examples in the docs do things like CPU on windows and GPU on Linux but all my boxes are linux.…
Getting the right version of PyTorch installed to have the correct kind of acceleration on each different platform you support has been a long-standing headache across many Python dependency management tools, not just uv. For example, here's the bug in poetry regarding this issue: https://github.com/python-poetry/poetry/issues/6409 As I understand it, recent versions of PyTorch have made this process somewhat easier,…
Switching from Pyenv to Uv
211–220 of 239 posts
Re: Switching from Pyenv to Uv
#212Earlier quoted context omitted.
I was working on a Raspberry Pi at a hackathon, and pip install was eating several minutes at a time. Tried uv for the first time and it was down to seconds.
Why would you be redoing your venv more than once?
I cancelled one at 4 minutes before switching to uv and having it finish in a few seconds
Re: Switching from Pyenv to Uv
#213Earlier quoted context omitted.
Getting the right version of PyTorch installed to have the correct kind of acceleration on each different platform you support has been a long-standing headache across many Python dependency management tools, not just uv. For example, here's the bug in poetry regarding this issue: https://github.com/python-poetry/poetry/issues/6409 As I understand it, recent versions of PyTorch have made this process somewhat easier,…
I end up going to the torch website and they have a nice little UI I can click what I have and it gives me the pip line to use.
Re: Switching from Pyenv to Uv
#214Earlier quoted context omitted.
The risk is obviously uv losing funding. I kinda hope the PSF has thought about this and has a contingency plan for uv winning and dying/becoming enshittified soon after.
If they never made any plan about how modules are installed and there is no official way… i doubt they made a plan about uv.
Re: Switching from Pyenv to Uv
#215Earlier quoted context omitted.
> Just try it. I don't need to be told to RTFM. I was asking for advice. My attention span is my most valuable commodity, and since I'm not really surprised or slowed down by setuptools, etc., it sounds like uv probably isn't worth investigating. Thanks.
It probably is. Just try it is the advice.
To answer my own question—and to actually help other people with similar use cases—I read about uv's build process and dependency locking. It does not appear to be able to lock dependencies for build distributions (wheels).
https://docs.astral.sh/uv/concepts/projects/build/
https://docs.astral.sh/uv/pip/compile/
However, it does mention that Python supports multiple build systems, which I didn't know, so this hasn't been a complete waste of my time.
Thanks!
Re: Switching from Pyenv to Uv
#216Earlier quoted context omitted.
It is... but basically it need to remember which groups are sync'd. For example if you use an extra, you have to keep track of it constantly because sync thrashes around between states all the time unless you play close and tedious attention. At least I haven't figured out how to make it remember which extras are "active". uv sync --extra gpu uv add matplotlib # the sync this runs undoes the --extra gpu uv sync # oop…
To make the change in your environment: 1. Create or edit the UV configuration file in one of these locations: - `~/.config/uv/config.toml` (Linux/macOS) - `%APPDATA%\uv\config.toml` (Windows) 2. Add a section for default groups to sync: ```toml [sync] include-groups = ["dev", "test", "docs"] # Replace with your desired group names ``` Alternatively, you can do something similar in pyproject.toml if you want to apply…
What I am struggling with is what you get after following the Configuring Accelerators With Optional Dependencies example:
https://docs.astral.sh/uv/guides/integration/pytorch/#config...
Part of what that does is set up rules that prevent simultaneously installing cpu and gpu versions (which isn't possible). If you use the optional dependencies example pyproject.toml then this is what happens:
$ uv sync --extra cpu --extra cu124
Using CPython 3.12.7
Creating virtual environment at: .venv
Resolved 32 packages in 1.65s
error: Extras `cpu` and `cu124` are incompatible with the declared conflicts: {`project[cpu]`, `project[cu124]`}
And if you remove the declared conflict, then uv ends up with two incompatible sources to install the same packages from uv sync --extra cpu --extra cu124
error: Requirements contain conflicting indexes for package `torch` in all marker environments:
- https://download.pytorch.org/whl/cpu
- https://download.pytorch.org/whl/cu124
After your comment I initially thought that perhaps the extras might be rewritten as group dependencies somehow to use the ~/.config/uv/config.toml but according to the docs group dependencies are not allowed to have conflicts with each other and must be installable simultaneously (makes sense since there is an --all-groups flag). That is you must be able to install all group dependencies simultaneously.Re: Switching from Pyenv to Uv
#217Earlier quoted context omitted.
I generally agree but one thing I find very frustrating (i.e. have not figured out yet) is how deal with extras well, particularly with pytorch. Some of my machines have GPU, some don't and things like "uv add" end up uninstalling everything and installing the opposite forcing a resync with the appropriate --extra tag. The examples in the docs do things like CPU on windows and GPU on Linux but all my boxes are linux.…
Does this help? https://github.com/astral-sh/uv/pull/7851
Re: Switching from Pyenv to Uv
#218Re: Switching from Pyenv to Uv
#219Earlier quoted context omitted.
I generally agree but one thing I find very frustrating (i.e. have not figured out yet) is how deal with extras well, particularly with pytorch. Some of my machines have GPU, some don't and things like "uv add" end up uninstalling everything and installing the opposite forcing a resync with the appropriate --extra tag. The examples in the docs do things like CPU on windows and GPU on Linux but all my boxes are linux.…
Getting the right version of PyTorch installed to have the correct kind of acceleration on each different platform you support has been a long-standing headache across many Python dependency management tools, not just uv. For example, here's the bug in poetry regarding this issue: https://github.com/python-poetry/poetry/issues/6409 As I understand it, recent versions of PyTorch have made this process somewhat easier,…
Re: Switching from Pyenv to Uv
#220Earlier quoted context omitted.
Strong agree. The respectful act of other package managers would be consider themselves deprecated and point to uv instead.
The risk is obviously uv losing funding. I kinda hope the PSF has thought about this and has a contingency plan for uv winning and dying/becoming enshittified soon after.