jupyterlite / jupyterlite/pyodide-kernel
%pip install magic with inline comment causes InvalidRequirement error
- Dominant language
- Python
- Stars
- 90
- Forks
- 47
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
## Description
When using JupyterLite, adding an inline comment to a %pip install line e.g.:
`%pip install seaborn # comment`
the comment is interpreted as part of the package list, resulting in an `InvalidRequirement` error.
The behavior appears inconsistently across browsers — for example, it fails in Brave (Chromium-based) but not in Chrome.
## Reproduce
1. Launch a JupyterLite notebook (e.g., from https://jupyterlite.github.io/demo).
2. In a code cell, enter the following line:
`%pip install seaborn # required to use seaborn in jupyterlite`
3. Run the cell.
## Expected behavior
The magic command parser strips the inline comments before passing the arguments to piplite, in this case resulting in seaborn being installed no matter the browser.
## Context
- JupyterLite version: latest (from https://jupyterlite.github.io/demo as of 03-07-2025)
- Operating System and version: Ubuntu 24.04.2 LTS
- Browser and version: Firefox 139.0.4 (64-bit)
Browser Output
Paste the output from your browser Javascript console here.
Contributor guide
Assessment
This issue has not been assessed yet.