tweag / blog-resources

Extra resources for Tweag's blog posts.
https://www.tweag.io/blog
38 stars 11 forks source link

[Monad-bayes] Running Notebook fails ValueError: "jupyterlab-ihaskell" is not a valid extension: #15

Closed timo-a closed 2 years ago

timo-a commented 3 years ago

Describe the bug Trying to run the notebook leads to

ValueError: "jupyterlab-ihaskell" is not a valid extension:
Missing extension module "lib/index.js"

To Reproduce Follow https://github.com/tweag/blog-resources/tree/master/monad-bayes-series and

$ git clone https://github.com/tweag/blog-resources.git
$ cd blog-resources/

Install nix via https://nixos.wiki/wiki/Nix_Installation_Guide

$ sudo install -d -m755 -o $(id -u) -g $(id -g) /nix
$ curl -L https://nixos.org/nix/install | sh
$ source $HOME/.nix-profile/etc/profile.d/nix.sh

Install and run cachix

$ nix-env -iA cachix -f https://cachix.org/api/v1/install
$ cachix use jupyterwith

add username to trusted-users in ~/.config/nix/nix.conf confirm with nix show-config | grep trusted-users

run nix-shell --option sandbox false

this fails because the root partition runs out of memory -> shut down pc, enlarge partition, restart. run nix-shell --option sandbox false again (without cachix use jupyterwith)
Eventual fail:

> /nix/store/sb3dfgiw8fgswvw0w8mhyghyqwxiar34-nodejs-10.17.0/bin/npm pack jupyterlab-ihaskell
/npm notice 
npm notice 📦  jupyterlab-ihaskell@0.0.12
npm notice === Tarball Contents === 
npm notice 0     style/index.css
npm notice 1.2kB package.json   
npm notice 464B  README.md      
npm notice === Tarball Details === 
npm notice name:          jupyterlab-ihaskell                     
npm notice version:       0.0.12                                  
npm notice filename:      jupyterlab-ihaskell-0.0.12.tgz          
npm notice package size:  866 B                                   
npm notice unpacked size: 1.6 kB                                  
npm notice shasum:        2922b8d1c37b6376287744d97d2357ad228c5297
npm notice integrity:     sha512-FXE3KGNNRadi7[...]0FNX+8H/AalEg==
npm notice total files:   3                                       
npm notice 
jupyterlab-ihaskell-0.0.12.tgz

Traceback (most recent call last):

  File "/nix/store/40nff5mxfs1516z1axnfmlb1i1kklhps-python3.7-jupyterlab-1.2.2/lib/python3.7/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

  File "/nix/store/40nff5mxfs1516z1axnfmlb1i1kklhps-python3.7-jupyterlab-1.2.2/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 93, in start
    ans = self.run_task()

  File "/nix/store/40nff5mxfs1516z1axnfmlb1i1kklhps-python3.7-jupyterlab-1.2.2/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 149, in run_task
    for i, arg in enumerate(self.extra_args)

  File "/nix/store/40nff5mxfs1516z1axnfmlb1i1kklhps-python3.7-jupyterlab-1.2.2/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 149, in <listcomp>
    for i, arg in enumerate(self.extra_args)

  File "/nix/store/40nff5mxfs1516z1axnfmlb1i1kklhps-python3.7-jupyterlab-1.2.2/lib/python3.7/site-packages/jupyterlab/commands.py", line 398, in install_extension
    return handler.install_extension(extension, pin=pin)

  File "/nix/store/40nff5mxfs1516z1axnfmlb1i1kklhps-python3.7-jupyterlab-1.2.2/lib/python3.7/site-packages/jupyterlab/commands.py", line 611, in install_extension
    info = self._install_extension(extension, tempdir, pin=pin)

  File "/nix/store/40nff5mxfs1516z1axnfmlb1i1kklhps-python3.7-jupyterlab-1.2.2/lib/python3.7/site-packages/jupyterlab/commands.py", line 1508, in _install_extension
    raise ValueError(msg % (extension, '\n'.join(messages)))

ValueError: "jupyterlab-ihaskell" is not a valid extension:
Missing extension module "lib/index.js"

An error occured.
ValueError: "jupyterlab-ihaskell" is not a valid extension:
Missing extension module "lib/index.js"
See the log file for details:  /tmp/nix-build-jupyterlab-extended.drv-0/jupyterlab-debug-vces37h5.log
Exiting application: jupyter
builder for '/nix/store/h4kz1d6y15isglvmdm0q8fh16i4fyasv-jupyterlab-extended.drv' failed with exit code 1
cannot build derivation '/nix/store/bpwnk2kg37b39rwjfr6dhzczbd1gyysw-python3.7-jupyterlab-1.2.2.drv': 1 dependencies couldn't be built
error: build of '/nix/store/7rgis0m1j5kvijjfz2bm30b3b969xwb5-ghci-monad-bayes.drv', '/nix/store/bpwnk2kg37b39rwjfr6dhzczbd1gyysw-python3.7-jupyterlab-1.2.2.drv', '/nix/store/ck9cs6amw1xiv8fcwbhkwbr9hrqkvlb2-ghc-monad-bayes.drv', '/nix/store/lz7lkj5s3gj2mvr7j1rajhc988x6zaag-ihaskell-kernel.drv' failed

try again with

cachix use jupyterwith
nix-shell --option sandbox false

Same error, slight variation:

....
See the log file for details:  /tmp/nix-build-jupyterlab-extended.drv-0/jupyterlab-debug-ae9up40y.log
Exiting application: jupyter
builder for '/nix/store/h4kz1d6y15isglvmdm0q8fh16i4fyasv-jupyterlab-extended.drv' failed with exit code 1
building '/nix/store/qz8s3wzi6wfws23s8ijsdl0qvvrjyri2-hlint-2.2.1.drv'...
...

Log file has different name, and like the first log file it doesn't exist. The last line of the above snippet building ... is new.

Expected behavior Jupiter notebook should start up without errors

Environment

Additional context I'm not sure if the restart is necessary to reproduce the error. I don't know how to restore the state before ever calling nix-shell --option sandbox false.