{"id":518,"library":"ipykernel","title":"ipykernel","description":"ipykernel provides the IPython kernel, which serves as the Python execution backend for Jupyter Notebooks, JupyterLab, and other Jupyter frontends. It facilitates interactive Python development, supports rich media outputs, and enables seamless code sharing within these environments. The current stable version is 7.2.0, and the project maintains an active development and release cadence.","status":"active","version":"7.2.0","language":"python","source_language":"en","source_url":"https://github.com/ipython/ipykernel","tags":["jupyter","kernel","ipython","interactive","notebook","frontend","python"],"install":[{"cmd":"pip install ipykernel","lang":"bash","label":"Install ipykernel"},{"cmd":"python -m ipykernel install --user --name=myenv --display-name=\"Python (My Environment)\"","lang":"bash","label":"Register kernel for Jupyter (recommended in a virtual environment)"}],"dependencies":[{"reason":"Requires Python 3.10 or newer.","package":"python","optional":false}],"imports":[{"note":"Used for embedding an IPython kernel into a Python application, not typically for general Jupyter usage.","symbol":"embed_kernel","correct":"from ipykernel.embed import embed_kernel"}],"quickstart":{"code":"import subprocess\nimport sys\nimport os\n\n# Ensure ipykernel is installed in the current environment\nsubprocess.check_call([sys.executable, '-m', 'pip', 'install', 'ipykernel'])\n\n# Define a unique name for your kernel (e.g., based on virtual environment name)\nenv_name = os.environ.get('VIRTUAL_ENV', 'default_env').split(os.sep)[-1]\ndisplay_name = f\"Python ({env_name.replace('_', ' ').title()} Environment)\"\n\n# Register the kernel with Jupyter\ntry:\n    subprocess.check_call([\n        sys.executable, '-m', 'ipykernel', 'install',\n        '--user', f'--name={env_name}', f'--display-name={display_name}'\n    ])\n    print(f'Successfully registered Jupyter kernel: \"{display_name}\" (name: {env_name})')\n    print('To use it, launch Jupyter Notebook/Lab and select this kernel for a new notebook.')\n    print('You can verify installed kernels with: jupyter kernelspec list')\nexcept subprocess.CalledProcessError as e:\n    print(f'Failed to register kernel: {e}')\n    print('Ensure Jupyter is installed (pip install notebook or pip install jupyterlab).')","lang":"python","description":"The primary use case for ipykernel is to provide a Python execution environment for Jupyter frontends. This quickstart demonstrates how to install ipykernel and register it as a new kernel in your current Python environment, making it available in Jupyter Notebook or JupyterLab. It's best practice to perform this within an activated virtual environment."},"warnings":[{"fix":"If issues arise, downgrade to `ipykernel < 7`. Review your code for assumptions about thread-local state or message timing. Consult the official changelog and GitHub issues for detailed migration guidance.","message":"ipykernel 7.0.0 introduced significant architectural changes for kernel subshells, including handling shell channel messages in a separate thread. While intended to be backward compatible for non-subshell users, these changes may break assumptions made by downstream libraries. Users encountering issues should consider pinning to `ipykernel < 7`.","severity":"breaking","affected_versions":"7.0.0 and later"},{"fix":"Upgrade your Python environment to 3.10 or newer, or pin `ipykernel < 7.0.0a3` (e.g., `pip install 'ipykernel<7'`).","message":"Support for Python 3.9 was dropped in `ipykernel 7.0.0a3`. Users on Python 3.9 or older must use `ipykernel` version 6.x or earlier.","severity":"breaking","affected_versions":"7.0.0a3 and later"},{"fix":"Ensure you are running `ipykernel` 6.30.1 or later if you were affected by this bug.","message":"Version 6.30.0 contained a bug that allowed control messages to be handled concurrently, which severely broke debugging in JupyterLab and VSCode. This was a critical regression fixed in version 6.30.1.","severity":"gotcha","affected_versions":"6.30.0"},{"fix":"Upgrade to `ipykernel 7.1.0` or `6.31.0` (or newer). If using an older version, you may need to manually configure `ZMQDisplayPublisher.store_display_history` if exposed.","message":"Prior to 7.1.0 (and 6.31.0 for the 6.x series), display outputs from magics like `%notebook` were not always included when saving sessions to `.ipynb` files, as `ZMQDisplayPublisher.store_display_history` defaulted to `False`.","severity":"gotcha","affected_versions":"< 7.1.0 and < 6.31.0"}],"env_vars":null,"last_verified":"2026-05-12T14:35:44.562Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Activate the desired Python environment and run `pip install ipykernel` (or `conda install ipykernel` if using Anaconda), then register the kernel with `python -m ipykernel install --user --name myenv --display-name \"Python (myenv)\"` (replace `myenv` and display name as appropriate).","cause":"The `ipykernel` package is not installed in the specific Python environment that Jupyter Notebook or JupyterLab is trying to use.","error":"ModuleNotFoundError: No module named 'ipykernel'"},{"fix":"Ensure `ipykernel` is installed and registered in the correct Python environment. Check Jupyter's output logs for more specific errors. Try upgrading/downgrading `pyzmq` (`pip install --upgrade pyzmq` or `pip install pyzmq==19.0.2`) or `tornado` if dependency issues are suspected, and verify the Python executable path in the kernel configuration.","cause":"A generic error indicating that the Jupyter kernel failed to start or unexpectedly stopped. This can be caused by missing or incompatible dependencies (like `pyzmq`), an incorrect Python interpreter selected, a corrupted kernel specification, or resource limitations.","error":"Kernel Died"},{"fix":"Execute the recommended command provided by the IDE, usually `\"<path_to_python_executable>\" -m pip install ipykernel` or simply `pip install ipykernel` in the activated terminal for that environment.","cause":"This message, often seen in IDEs like VS Code, indicates that the selected Python interpreter for the notebook does not have `ipykernel` installed.","error":"Running cells with 'Python X.Y.Z' requires the ipykernel package."},{"fix":"Check for firewall or VPN interference. Try changing between `localhost` and `127.0.0.1` in the browser URL. Ensure no other applications are using the same port. If the kernel is dying, refer to the 'Kernel Died' fix.","cause":"The Jupyter frontend cannot establish or maintain a connection with the `ipykernel` process. This can be due to network issues, port conflicts, security software interference, or a crashed kernel.","error":"A connection to the notebook server could not be established."}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.24,"mem_mb":30.4,"disk_size":"120.1M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.76,"mem_mb":31.2,"disk_size":"104M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":3.15,"mem_mb":35.2,"disk_size":"104.0M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.58,"mem_mb":36,"disk_size":"112M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":3,"mem_mb":34.4,"disk_size":"117.3M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":3.05,"mem_mb":35.3,"disk_size":"105M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.69,"mem_mb":36,"disk_size":"117.1M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.9,"mem_mb":36.9,"disk_size":"104M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.47,"mem_mb":31.5,"disk_size":"96.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":2.15,"mem_mb":32.3,"disk_size":"81M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}