Skip to content

Commit df71bac

Browse files
committed
deploy: 5849fde
1 parent 29d91d2 commit df71bac

3 files changed

Lines changed: 52 additions & 1 deletion

File tree

_sources/guides/environment_setup.md.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,34 @@ uv run python my_script.py
8888
uv run jupyter lab
8989
```
9090

91+
### Registering the environment as a Jupyter kernel
92+
93+
uv does not automatically register your virtual environment as a Jupyter kernel. This is by design — uv manages only the environment itself, not the kernel registry that Jupyter uses to discover Python environments. As a result, even after running `uv sync`, your environment will not appear in JupyterLab's kernel picker until you register it manually.
94+
95+
To register it, first make sure `ipykernel` is installed in the environment, then use it to add the kernel to Jupyter's registry:
96+
97+
```bash
98+
uv add ipykernel
99+
uv run python -m ipykernel install --user --name my-experiment --display-name "My Experiment"
100+
```
101+
102+
- `--name` is a short identifier used internally (no spaces).
103+
- `--display-name` is what appears in the JupyterLab UI.
104+
105+
After running this, restart JupyterLab and the kernel will be available in the launcher and the kernel picker.
106+
107+
To list all registered kernels:
108+
109+
```bash
110+
uv run jupyter kernelspec list
111+
```
112+
113+
To remove a kernel you no longer need:
114+
115+
```bash
116+
uv run jupyter kernelspec remove my-experiment
117+
```
118+
91119
### Adding new dependencies
92120

93121
```bash

guides/environment_setup.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,28 @@ <h3>Activating the environment<a class="headerlink" href="#activating-the-enviro
516516
</pre></div>
517517
</div>
518518
</section>
519+
<section id="registering-the-environment-as-a-jupyter-kernel">
520+
<h3>Registering the environment as a Jupyter kernel<a class="headerlink" href="#registering-the-environment-as-a-jupyter-kernel" title="Link to this heading">#</a></h3>
521+
<p>uv does not automatically register your virtual environment as a Jupyter kernel. This is by design — uv manages only the environment itself, not the kernel registry that Jupyter uses to discover Python environments. As a result, even after running <code class="docutils literal notranslate"><span class="pre">uv</span> <span class="pre">sync</span></code>, your environment will not appear in JupyterLab’s kernel picker until you register it manually.</p>
522+
<p>To register it, first make sure <code class="docutils literal notranslate"><span class="pre">ipykernel</span></code> is installed in the environment, then use it to add the kernel to Jupyter’s registry:</p>
523+
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>uv<span class="w"> </span>add<span class="w"> </span>ipykernel
524+
uv<span class="w"> </span>run<span class="w"> </span>python<span class="w"> </span>-m<span class="w"> </span>ipykernel<span class="w"> </span>install<span class="w"> </span>--user<span class="w"> </span>--name<span class="w"> </span>my-experiment<span class="w"> </span>--display-name<span class="w"> </span><span class="s2">&quot;My Experiment&quot;</span>
525+
</pre></div>
526+
</div>
527+
<ul class="simple">
528+
<li><p><code class="docutils literal notranslate"><span class="pre">--name</span></code> is a short identifier used internally (no spaces).</p></li>
529+
<li><p><code class="docutils literal notranslate"><span class="pre">--display-name</span></code> is what appears in the JupyterLab UI.</p></li>
530+
</ul>
531+
<p>After running this, restart JupyterLab and the kernel will be available in the launcher and the kernel picker.</p>
532+
<p>To list all registered kernels:</p>
533+
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>uv<span class="w"> </span>run<span class="w"> </span>jupyter<span class="w"> </span>kernelspec<span class="w"> </span>list
534+
</pre></div>
535+
</div>
536+
<p>To remove a kernel you no longer need:</p>
537+
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>uv<span class="w"> </span>run<span class="w"> </span>jupyter<span class="w"> </span>kernelspec<span class="w"> </span>remove<span class="w"> </span>my-experiment
538+
</pre></div>
539+
</div>
540+
</section>
519541
<section id="adding-new-dependencies">
520542
<h3>Adding new dependencies<a class="headerlink" href="#adding-new-dependencies" title="Link to this heading">#</a></h3>
521543
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>uv<span class="w"> </span>add<span class="w"> </span>some-package
@@ -679,6 +701,7 @@ <h3>Exporting and sharing your environment<a class="headerlink" href="#exporting
679701
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#project-structure-pyproject-toml">Project structure: <code class="docutils literal notranslate"><span class="pre">pyproject.toml</span></code></a></li>
680702
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#creating-and-syncing-the-environment">Creating and syncing the environment</a></li>
681703
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#activating-the-environment">Activating the environment</a></li>
704+
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#registering-the-environment-as-a-jupyter-kernel">Registering the environment as a Jupyter kernel</a></li>
682705
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#adding-new-dependencies">Adding new dependencies</a></li>
683706
</ul>
684707
</li>

0 commit comments

Comments
 (0)