I tried to get jupyterlab working via uv tool install
today and ran into some sharp edges.
You can start like this:
uv tool install jupyterlab
That ran for a while and output:
Installed 4 executables: jlpm, jupyter-lab, jupyter-labextension, jupyter-labhub
It also gave me a warning about my PATH. I fixed that with:
uv tool ensure-path
On one other machine this didn't work because it refused to over-write a previous installation. The fix was to run uv tool install
with --force
:
uv tool install jupyterlab --force
Now we can start jupyterlab with:
jupyter-lab
This was the biggest sticking point for me. Jupyter has a useful magic command for installing packages:
%pip install llm
When I tried to run this I got this error:
/Users/simon/.local/share/uv/tools/jupyterlab/bin/python: No module named pip
It turns out we have an installation with no pip
binary.
There may be a better way to do this, but I found that this worked, run in a Jupyter notebook cell:
import subprocess, sys
subprocess.check_call([sys.executable, "-m", "ensurepip"])
After I ran this, the %pip
magic command worked as expected - I didn't even need to restart the kernel.
I opened an issue about this and submitted a PR with a potential fix.
Created 2025-03-08T14:58:18-06:00, updated 2025-03-08T15:31:00-06:00 · History · Edit