ModuleNotFoundError: No module named 'ipykernel' in jupyter lab, how to fix
Fixes `ModuleNotFoundError: No module named 'ipykernel'` inside JupyterLab: install ipykernel into the kernel's python and register the kernel spec. Use when the notebook UI loads but no kernel will start. Not for kernels that start then die.
TL;DR
JupyterLab is running fine, but the python environment behind your kernel never got ipykernel installed, so no kernel process can start. Run python -m pip install ipykernel in that exact environment, then python -m ipykernel install --user --name myenv --display-name "Python (myenv)". The kernel then appears in the launcher and connects on the first try.
ModuleNotFoundError: No module named 'ipykernel'Use this when
- JupyterLab opens but starting any python kernel fails with ModuleNotFoundError for ipykernel.
- The traceback or server log shows the missing module right after kernel launch is attempted.
- A fresh conda env or venv shows up in kernelspec list but cannot start.
Not for this skill when
- The kernel starts and then dies mid-cell. That is a crash, not a missing package.
- JupyterLab itself will not launch. That is a server-side install problem.
Steps
- Find which python the kernel spec uses:
jupyter kernelspec list, then read theargvin the spec's kernel.json. Verify: you know the exact python path. - Install ipykernel into that python:
[that python] -m pip install ipykernel. Verify:[that python] -c "import ipykernel"succeeds. - Register the spec:
[that python] -m ipykernel install --user --name [env-name] --display-name "Python ([env-name])". Verify:jupyter kernelspec listshows the entry. - Restart JupyterLab and pick the new kernel in the launcher. Verify: the kernel status dot goes solid and
1+1executes. - If the env is conda-managed, prefer
conda install -n [env-name] ipykernelto keep the solver happy. Verify:conda list -n [env-name] ipykernelshows it.
Variant phrasings
no module named ipykernel jupyter
The generic search. Same missing-package fix.
ipykernel not installed kernel error
Log-style phrasing. Install into the kernel's python, not the server's.
jupyter lab kernel not found ipykernel
Launcher-side phrasing. The registration step is what makes it appear.
Compatibility: JupyterLab 3/4, notebook 6/7, ipykernel 6.x. The install-and-register flow is the same on pip and conda.
Why it happens
JupyterLab and the kernel are separate processes, often from separate environments. The Lab server only needs jupyter_server; the kernel needs ipykernel. Fresh virtualenvs and conda envs routinely get a kernelspec copied in without ipykernel ever being installed there, so Lab offers a kernel it cannot launch.
Edge cases / pitfalls
- Installing ipykernel into the Lab server's environment does not fix a kernel in another env. Match the python exactly.
- Do not edit kernel.json by hand to point at a different python. Reinstall the spec from the right python instead.
--userinstalls go to your home kernels dir. In multi-user JupyterHub, register system-wide or per user deliberately.
Provenance
Resolved from the public thread: https://vectle.com/posts/pstUGKVg6h107NbMy6arNRpA