question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use nb_conda_kernels find conda python kernels

See original GitHub issue

Currently, I create separate conda environments for most projects to facilitate dependency management. nb_conda_kernels supports this workflow since I only need to install jupyterlab in a single conda env. However jupyterbook is not aware of python kernels outside the environment it is installed in, so it needs to be installed in each conda environment separately. The kernel name in the notebook also needs to be changed manually to python3 instead of e.g. conda-myenvname-py because the latter throws an error saying the kernel cannot be found.

It would be great if jupyterbook could also make use of nb_conda_kernels to execute notebooks with the specified conda kernel, similarly to how jupyterlab does it.

Related: https://github.com/executablebooks/meta/discussions/222 and https://github.com/executablebooks/jupyter-cache/issues/63

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
joelostblomcommented, Sep 24, 2021

In case anyone else comes across this, my current workaround is to install jupyter-book in the environment that has the packages you want to use. Then, instead of changing the kernel names of each notebook manually, you can edit the jupyterbook utils file to specify the kernel name (e.g. ~/miniconda3/envs/jb_conda_env/lib/python3.9/site-packages/jupyter_cache/executors/utils.py). You need to add kernel_name='python3' as an input parameter to the executenb function at the end of this file.

0reactions
joelostblomcommented, Jan 31, 2022

Adding a note that nb_conda_kernels did add a mechanisms for it to be used with other applications than jupyterlab, etc in an earlier release https://github.com/Anaconda-Platform/nb_conda_kernels/releases/tag/2.3.0. I am not sure it would be helpful here but adding it just in case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GitHub - Anaconda-Platform/nb_conda_kernels
This extension enables a Jupyter Notebook or JupyterLab application in one conda environment to access kernels for Python, R, and other languages found...
Read more >
Nb Conda Kernels - :: Anaconda.org
Info: This package contains files in non-standard labels. linux-ppc64le v2.3.1; osx-arm64 v2.3.1; linux-64 v2 ...
Read more >
Get Your Conda Environment to Show in Jupyter Notebooks
1. First, install nb_conda_kernels in your base environment. · 2. Next, create a new environment. · 3. Activate the environment you want to...
Read more >
Conda environments not showing up in Jupyter Notebook
This is the best answer as of Jan 2018. Jupyter should auto-discover your kernel on startup if you simply conda install ipykernel inside...
Read more >
nb-conda-store-kernels - PyPI
This extension enables a Jupyter Notebook or JupyterLab application to access environments stored in Conda-Store and run kernels for Python, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found