-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add uv instructions #558
Comments
In general I'm supportive.
For contributors:
In general, I'm of two minds about mamba, micromamba, uv, pixi. If you're already aware of them, then it's great to have the instructions. But otherwise, most intro Python things still use pip or conda, so then these "newfangled" "fancy" things cause cognitive load. Someone will have conda from one tutorial or plugin and uv from another and pixi from a workshop. Bleh. |
The |
@Czaki thanks! it's actually documented here: Thinking about it more based on the uv docs, I don't think we should encourage this to be clear, |
I think this is a very important point. Fortunately, most of the conda-variants still use conda so they are compatible. Like, if I set up someone an environment with mamba I tell them it's conda and so far everything works as expected 😉 But, for me, users (some that DESPISE the command line / code) that I've switched to uv from mamba find it so much easier and intuitive to upgrade. The problem is basically ... do I do the Fortunately, to answer one question, yes,
I tend to agree with this, and hope it's the case. BUT, that |
Yeah if you're setting up someone, then do what works for you since you will support them. Anyhow bundle has the advantage of no pre-reqs. With Edit: FYI as of conda 23.10, conda is mamba. |
As an updated way for us to integrate this with a typical conda environment (I haven't tried this before, but maybe it's what I'll use with others going forward)
Note: This is the speed of uv with a clean installation (I think these weren't cached)
Also to me one of the advantages of the |
That's a bit of an exaggeration — as of that version, conda uses the libmamba solver by default, which mamba (a totally different package) used from the beginning.
That's insane @TimMonko! Can you please verify about the cache thing? Anyway, I totally know all the arguments in favour (these new tools are way faster and have made some nice new design decisions that they could do because they were not hamstrung by backwards compatibility) and against (mixing tools is an issue and indeed most folks will come from the most common tutorials, which are pip and conda based). My proposed solution is that we keep pip and conda front and centre and we add an "advanced installation paths" page (name TBD) where we can go crazy with folks' preferred tools. |
I hadn't thought of using uv in a conda env, I guess since it's a pip replacement it should work -- and it does. Anyhow, based on the uv docs, I'm not sure that's a pattern we should be recommending. So I think if we opt to recommend Edit: we have tabs for the user install instructions, so could add a (Re: mamba, my understanding is that mamba and conda are in fact now identical and mamba has been deprecated.) |
Reinstalling all packages, but I think this uses the cache (it 'refreshes' the cache, whatever that means) - takes about 4.7 seconds (with an IRL stopwatch, since some things overlap)
Without using the cache, it preps the whole env in ~38s.
Compared to pip with everything cached And then pip with no cache So most of the time spent with uv is downloading (if no cache), otherwise environment builds super fast. Whereas with pip most of the time is spent building. Mamba was 36s to find packages, 32s to download, and 39s to simultaneous extract packages (+7s from download), then 16s to build. HAHA I knew mamba/conda got much faster recently, but didn't realize it was much faster than pip... For comparison these were all done in a different mamba=1.4.2 environment made with
I think you are right on this, which was my hope in getting this discussed. The uv python installs are fast and super easy to manage. You can also switch python version on-the-fly within a uv environment. So takes just a few seconds to rebuild an environment for testing something ( |
📚 New content request
Cross-posted in napari/napari#7573
With the recent increase in the popularity of
uv
,napari
should make a concerted effort to offer installation instructions withuv
. There are a multitude of ways to accessnapari
with uv, but these have inconsistent behavior (at least on Windows). I'll detail especially why this needs documentated, but the usage pattern either results in surprising errors or differences from typicalpip
/conda
usage. Despite this, uv is so incredibly fast and easy that I have found it much easier to recommend for colleagues to keep their napari up to date and they much prefer its speed (despite each time I have to figure something out different on each computer).uv sync
/uv lock
/uv add
These are intended for using with projects, which is a very useful part of uv, but doesn't seem to work great out of the box with napari
uv sync --extra all
results in solving the wrong pyqt-qt5 which is an extreme pain to fix. message:error: Distribution
pyqt5-qt5==5.15.16 @ registry+https://pypi.org/simple` can't be installed because it doesn't have a source distribution or wheel for the current platformCan be fixed by
uv pip` installing in theuv sync
will by default attempt to use Py 3.13, which breaks. Also at least on Windows, 3.12 gives me a hassle, whereas 3.11 is fine.uv pip
uv pip install -e .[all]
works very smoothly when just then usingnapari
in the command line with that venvs parent. BUT this does not work well with the usualmamba activate env
type pattern which is useful across projects. Ultimately, because of how fast uv is, there is likely a movement towards per-project installs, but this is not the pattern that will have been used by many napari users for a while.uv run
uv run napari
will not succeed because there is no Qt install. Not solved withuv run napari --extra all
or any equivalent. Error message tells user best guess is that napari was installed withpip
(incorrect), so does not provide solutionuv tool install
uv tool install napari[all] --upgrade
->uvx napari
oruv tool run napari
works. Closest functionality to a simple pip environment, BUT has the caveats of being a separated environment.uv tool install -e .[all]
is a very handy way to quickly test a napari branch and use in editable mode, but has the problem of being a global tool, so not really useful for environment managementunclear what
napari
in the command line does after using uv. Does it use some root uv version ofnapari
? is it only with uv added to path? I actually haven't figured this out yet myselfThe text was updated successfully, but these errors were encountered: