vaibhavsagar / notebooks

Jupyter notebooks
BSD 3-Clause "New" or "Revised" License
58 stars 7 forks source link

Modules could not be loaded when executing notebook cells #7

Closed laaksonel closed 2 weeks ago

laaksonel commented 3 weeks ago

Hi, I commented out all the other notebooks except callcc in flake.nix. The build was successful. However, when running the notebook by executing ./result/callcc/bin/jupyter-notebook, Jupyter launches just fine but the execution of individual cells in the notebook never finishes.

I get this error message:

[I 2024-09-05 14:40:02.249 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (5/5), new random ports
ihaskell: <interactive>:1:1: error:
    Could not load module `IHaskell.Eval.Widgets'
    It is a member of the hidden package `ihaskell-0.11.0.0'.
    You can run `:set -package ihaskell' to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
<interactive>:1:1: error:
    Could not load module `IHaskell.IPython.Stdin'
    It is a member of the hidden package `ihaskell-0.11.0.0'.
    You can run `:set -package ihaskell' to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
<interactive>:1:1: error:
    Could not load module `IHaskell.Display'
    It is a member of the hidden package `ihaskell-0.11.0.0'.
    You can run `:set -package ihaskell' to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
<interactive>:1:1: error:
    Could not load module `IHaskell.Display'
    It is a member of the hidden package `ihaskell-0.11.0.0'.
    You can run `:set -package ihaskell' to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
<interactive>:1:1: error:
    Could not load module `Language.Haskell.TH'
    It is a member of the hidden package `template-haskell-2.20.0.0'.
    You can run `:set -package template-haskell' to expose it.
    (Note: this unloads all the modules in the current scope.)
    It is a member of the hidden package `ghc-lib-parser-9.6.5.20240423'.
    You can run `:set -package ghc-lib-parser' to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
<interactive>:1:1: error:
    Could not load module `System.Posix.IO'
    It is a member of the hidden package `unix-2.8.4.0'.
    You can run `:set -package unix' to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
<interactive>:1:1: error:
    Could not load module `System.Directory'
    It is a member of the hidden package `directory-1.3.8.4'.
    You can run `:set -package directory' to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
[W 2024-09-05 14:40:05.265 ServerApp] AsyncIOLoopKernelRestarter: restart failed
[W 2024-09-05 14:40:05.265 ServerApp] Kernel 32f9e23b-8782-4bad-8bcd-fb46041d4728 died, removing from map.

Any idea what this is about?

vaibhavsagar commented 3 weeks ago

The notebook format has changed since I made that notebook, so if you create a new notebook in JupyterLab and copy the contents of the cells over one by one it should work.

laaksonel commented 2 weeks ago

I created a new notebook via Jupyter UI. When I opened the notebook in browser, Jupyter immediately started throwing the same errors as before. I didn't even have time to type any code into the new notebook. I tried both jupyter-notebook and jupyter-lab and exactly the same thing happens. So it seems the kernel cannot be fully loaded into Jupyter regardless of the code content.

Edit: funnily enough, if I change compiler version to ghc925, it executes the cells just fine. I also tried ghc948 but then it ends up throwing the same errors as with ghc96.

vaibhavsagar commented 2 weeks ago

I updated my notebook and committed the changes. It works for me with result/callcc/bin/jupyter lab.

laaksonel commented 2 weeks ago

There was .ghc directory in my $HOME which seems to be the root of all evil here. After removing the whole .ghc, the notebook cells run as expected.

In any case, thank you for the help.