{"title":"River Jiang","link":[{"@attributes":{"href":"https:\/\/riverjiang.com\/atom.xml","rel":"self"}},{"@attributes":{"href":"https:\/\/riverjiang.com\/"}}],"updated":"2026-11-10T19:22:00+00:00","id":"https:\/\/riverjiang.com","author":{"name":"River Jiang"},"entry":{"title":"Running jupyter lab locally using uv","link":{"@attributes":{"href":"https:\/\/riverjiang.com\/2026\/run-jupyter\/"}},"updated":"2026-02-20T00:00:00+00:00","id":"https:\/\/riverjiang.com\/2026\/run-jupyter","content":"<p>A bit of a doozy of an invocation to get a jupyter notebook launched locally.<\/p>\n\n<ul>\n  <li>runs with <code class=\"language-plaintext highlighter-rouge\">uv<\/code> so no need to install jupyter itself and keeps packages sandboxed<\/li>\n  <li>uses uv\u2019s <code class=\"language-plaintext highlighter-rouge\">.venv<\/code> in current directory<\/li>\n  <li>doesn\u2019t install this kernel globally, just installs it locally within the <code class=\"language-plaintext highlighter-rouge\">.venv<\/code> directory<\/li>\n  <li>doesn\u2019t show the native python kernel so the venv kernel is the only one that pops up\n(removes need to select kernel called \u201cvenv\u201d within jupyter lab after starting it)<\/li>\n  <li>hosts on 0.0.0.0<\/li>\n  <li>headless<\/li>\n  <li>doesn\u2019t require token<\/li>\n<\/ul>\n\n<div class=\"language-sh highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>uv run <span class=\"nt\">--with<\/span> ipykernel python <span class=\"nt\">-m<\/span> ipykernel <span class=\"nb\">install<\/span> <span class=\"nt\">--prefix<\/span> .venv <span class=\"nt\">--name<\/span> venv <span class=\"o\">&amp;&amp;<\/span> <span class=\"nv\">JUPYTER_DATA_DIR<\/span><span class=\"o\">=<\/span>.venv\/share\/jupyter uv run <span class=\"nt\">--with<\/span> jupyter jupyter lab <span class=\"nt\">--ip<\/span> 0.0.0.0 <span class=\"nt\">--no-browser<\/span> <span class=\"nt\">--ServerApp<\/span>.token<span class=\"o\">=<\/span><span class=\"s1\">''<\/span> <span class=\"nt\">--KernelSpecManager<\/span>.ensure_native_kernel<span class=\"o\">=<\/span>False\n<\/code><\/pre><\/div><\/div>\n\n<p>I save this as an abbreviation in my <code class=\"language-plaintext highlighter-rouge\">fish<\/code> config in <code class=\"language-plaintext highlighter-rouge\">~\/.config\/fish\/config.fish<\/code>:<\/p>\n\n<div class=\"language-sh highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>abbr <span class=\"nt\">-a<\/span> jupyter <span class=\"s2\">\"uv run --with ipykernel python -m ipykernel install --prefix .venv --name venv &amp;&amp; JUPYTER_DATA_DIR=.venv\/share\/jupyter uv run --with jupyter jupyter lab --ip 0.0.0.0 --no-browser --ServerApp.token='' --KernelSpecManager.ensure_native_kernel=False\"<\/span>\n<\/code><\/pre><\/div><\/div>\n"}}