Skip to content

jupyter kernelspec install copies way too much data #1070

@dimpase

Description

@dimpase

in the Python library sagemath we have 10-year old code which installs our Jupyter kernel. We would like to replace it with jupyter kernelspec install

(sagemath can be programmed in an extension of Python which needs on the fly pre-parsing to convert it into Python, hence we can't just use ipython kernel).

However, while jupyter kernelspec install --user works, it results in gigabytes of data being copied to ~/, most of it being .so files coming from the compiled Cython and other Python extensions. Is there a way around this, by setting appropriate paths?

Sagemath typically is installed in a venv, so we hoped that replacing --user with --sys-prefix might be the more logical choice, but this does not work, as jupyter tries to install the kernel into /usr (where the Python used to create the venv lives) rather than into the the venv itself. Is this a bug? Why does it do this kind of de-referencing, breaking the very idea of what a Python venv is for?

This is observed on a reasonably up to date jupyter:

jupyter --version
Selected Jupyter core packages...
IPython          : 9.4.0
ipykernel        : 6.29.5
ipywidgets       : 8.1.7
jupyter_client   : 8.6.3
jupyter_core     : 5.8.1
jupyter_server   : 2.16.0
jupyterlab       : 4.4.6
nbclient         : 0.10.2
nbconvert        : 7.16.6
nbformat         : 5.10.4
notebook         : 7.4.5
qtconsole        : 5.6.1
traitlets        : 5.14.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions