Skip to content

%pip install magic with inline comment causes InvalidRequirement error #198

@ArturoAmorQ

Description

@ArturoAmorQ

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions