# Using nb\_conda\_kernels to switch envs in Jupyter OOD

**URL:** <https://discourse.openondemand.org/t/using-nb-conda-kernels-to-switch-envs-in-jupyter-ood/1997>\
**Category:** Get Help\
**Tags:** question\
**Created:** [April 4, 2022, 2:55pm UTC](https://discourse.openondemand.org/t/using-nb-conda-kernels-to-switch-envs-in-jupyter-ood/1997 "2022-04-04T14:55:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![RonRahaman](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/ronrahaman/32/1031_2.png) [@RonRahaman](https://discourse.openondemand.org/u/RonRahaman)\
**Post date:** [April 4, 2022, 2:55pm UTC](https://discourse.openondemand.org/t/using-nb-conda-kernels-to-switch-envs-in-jupyter-ood/1997/1 "2022-04-04T14:55:06Z")

</div>

Hi all,

We’d like to offer our users the ability to run Jupyter in OOD from one of their own conda environments. I saw a few ideas here that (I think) could work for us:

- [Jupyter notebook interactive app via conda environments](https://discourse.openondemand.org/t/jupyter-notebook-interactive-app-via-conda-environments/721)
- [Add an option to source a setup script before starting Jupyter](https://discourse.openondemand.org/t/add-an-option-to-source-a-setup-script-before-starting-jupyter/1406)
- [Handle multiple versions of Jupyter Notebooks](https://discourse.openondemand.org/t/handle-multiple-versions-of-jupyter-notebooks/32)

But we were interested if [nb\_conda\_kernels](https://github.com/Anaconda-Platform/nb_conda_kernels) could let our users switch envs in Jupyter OOD. Our thought was that the user would startup Jupyter in OOD from our sitewide module (as usual), and then they could switch to a Python kernel from their own conda env. Has anyone tried setting this up?

If not, I’ll give it a shot a shot and report back here.

Thanks!  
Ron

* * *

Ron Rahaman  
Research Scientist II  
Partnership for an Advanced Computing Environment (PACE)  
Georgia Institute of Technology

---

<div class="post-metadata">

**Author:** ![gbyrket](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/gbyrket/32/894_2.png) [@gbyrket](https://discourse.openondemand.org/u/gbyrket)\
**Post date:** [April 4, 2022, 3:29pm UTC](https://discourse.openondemand.org/t/using-nb-conda-kernels-to-switch-envs-in-jupyter-ood/1997/2 "2022-04-04T15:29:59Z")

</div>

Hi Ron.

Welcome to the board. Thanks for posting! One of my colleagues referenced the following link. Please let us know if it helps or not.

> **[HOWTO: Use a Conda/Virtual Environment With Jupyter](https://www.osc.edu/resources/getting_started/howto/howto_use_a_condavirtual_environment_with_jupyter)**
>
> Conda/Virtual environments must be installed on JupyterLab or Jupyter Notebook prior to use. Whereas older versions of Conda automatically installed a Jupyter kernel, users must now manually perform the installation process. To perform the...

Thanks,  
-gerald

---

<div class="post-metadata">

**Author:** ![RonRahaman](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/ronrahaman/32/1031_2.png) [@RonRahaman](https://discourse.openondemand.org/u/RonRahaman)\
**Post date:** [April 4, 2022, 3:49pm UTC](https://discourse.openondemand.org/t/using-nb-conda-kernels-to-switch-envs-in-jupyter-ood/1997/3 "2022-04-04T15:49:05Z")

</div>

Thanks Gerald! For this to work, do we need to do any extra configuration for our Jupyter app in OOD?

---

<div class="post-metadata">

**Author:** ![RonRahaman](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/ronrahaman/32/1031_2.png) [@RonRahaman](https://discourse.openondemand.org/u/RonRahaman)\
**Post date:** [April 4, 2022, 3:53pm UTC](https://discourse.openondemand.org/t/using-nb-conda-kernels-to-switch-envs-in-jupyter-ood/1997/4 "2022-04-04T15:53:03Z")

</div>

I would think that, in our `script.sh.erb`, we would have the logic to run the user’s jupyter’s kernel, rather than our sitewide jupyter kernel. If so, do you have an additional input field for the user’s desired environment?

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [April 4, 2022, 3:59pm UTC](https://discourse.openondemand.org/t/using-nb-conda-kernels-to-switch-envs-in-jupyter-ood/1997/5 "2022-04-04T15:59:01Z")

</div>

From an OOD perspective it’s just a module so there’s nothing on that side.

The module itself that get’s loaded may have to do some fancy footwork. @zyou How is our Jupyter module setup such that it can load a users’ kernels?

---

<div class="post-metadata">

**Author:** ![RonRahaman](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/ronrahaman/32/1031_2.png) [@RonRahaman](https://discourse.openondemand.org/u/RonRahaman)\
**Post date:** [April 5, 2022, 3:32pm UTC](https://discourse.openondemand.org/t/using-nb-conda-kernels-to-switch-envs-in-jupyter-ood/1997/6 "2022-04-05T15:32:23Z")

</div>

This worked really well for us:

> **[Using Launcher](https://www.carc.usc.edu/user-information/user-guides/software-and-programming/jupyter-kernels/)**
>
> USC's Center for Advanced Research Computing supports computational research and data-driven solutions.

If the user creates an ipython kernel from their virtual env (using `ipykernel install`), then Jupyter will pick it up. Then their kernel will be available from the “New” dropdown menu along with the other pre-installed kernels. We didn’t have to reconfigure anything in our OOD setup.

---

<div class="post-metadata">

**Author:** ![skelting1](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/skelting1/32/940_2.png) [@skelting1](https://discourse.openondemand.org/u/skelting1)\
**Post date:** [April 6, 2022, 4:20pm UTC](https://discourse.openondemand.org/t/using-nb-conda-kernels-to-switch-envs-in-jupyter-ood/1997/7 "2022-04-06T16:20:39Z")

</div>

Hello! We are have a custom environment option for users at the University of Central Oklahoma.

You can find our our Jupyter OnDemand application here: [GitHub - UCO-HPC/buddy-jupyter: An app designed for UCO's OnDemand that launches a Jupyter server session](https://github.com/UCO-HPC/buddy-jupyter)

This method has worked well for us so far. Let me know if there are any questions about our setup.

~Sam Kelting

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)\
**Post date:** [October 3, 2022, 4:20pm UTC](https://discourse.openondemand.org/t/using-nb-conda-kernels-to-switch-envs-in-jupyter-ood/1997/8 "2022-10-03T16:20:49Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
