Subject: bug#52139: jupyter trying to modify /gnu/store

From: Ludovic Courtès <[email-masked]>
Date: Tue, 14 Dec 2021 16:06:58 +0100

Hi Lars,

Lars-Dominik Braun <[email-masked]> skribis:

>> But precisely: as Alexander wrote, when JUPYTER_CONFIG_DIR points to the
>> store, jupyterlab cannot drop a config file there.  Or am I missing
>> something?
> sorry, my message was unclear here. The config file is written at
> build time.

Oh I see.

>> BTW, if JUPYTER_CONFIG_DIR is meant to contain a directory name, as
>> opposed to a colon-separated search path, we should make this change:
> Looking at the documentation[1] again this is correct, but I feel we
> should use JUPYTER_CONFIG_PATH instead, because it supports
> colon-delimited entries, see attached patch. However that does not get
> rid of error messages like these, when trying to use Settings→JupyterLab
> Theme for example:
>
> [W 08:10:14.476 LabApp] 500 PUT /lab/api/workspaces/lab?1639383014500 (127.0.0.1): [Errno 30] Read-only file system: '/gnu/store/8q7wdpdddfqh46plbbsa3rwci5092n5y-profile/etc/jupyter/lab'
>
> So it seems that JUPYTER_CONFIG_PATH overrides the default
> JUPYTER_CONFIG_DIR, when the latter is not set. Or maybe guix-science’s
> jupyterlab is simply too old – not sure right now.

OK.

> +++ b/gnu/packages/python-xyz.scm
> @@ -8478,7 +8478,7 @@ (define-public python-jupyter-core
>      ;; search paths.
>      (native-search-paths
>       (list (search-path-specification
> -            (variable "JUPYTER_CONFIG_DIR")
> +            (variable "JUPYTER_CONFIG_PATH")
>              (files '("etc/jupyter")))
>             (search-path-specification
>              (variable "JUPYTER_PATH")
> @@ -12145,8 +12145,6 @@ (define-public python-nbconvert
>               (when tests?
>                 ;; Some tests invoke the installed nbconvert binary.
>                 (add-installed-pythonpath inputs outputs)
> -               ;; Tries to write to this path.
> -               (unsetenv "JUPYTER_CONFIG_DIR")
>                 ;; Tests depend on templates installed to output.
>                 (setenv "JUPYTER_PATH"
>                         (string-append
> @@ -12254,6 +12252,8 @@ (define-public python-notebook
>                 ;; Some tests do not expect all files to be installed in the
>                 ;; same directory, but JUPYTER_PATH contains multiple entries.
>                 (unsetenv "JUPYTER_PATH")
> +               ;; Interferes with tests that check paths.
> +               (unsetenv "JUPYTER_CONFIG_PATH")
>                 ;; Some tests need HOME
>                 (setenv "HOME" "/tmp")
>                 (with-directory-excursion "/tmp"

If that works for you, go for it.

Thanks,
Ludo’.