Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jupyter can't connect to kernel #1128

Closed
talismanick opened this issue Nov 30, 2019 · 11 comments
Closed

Jupyter can't connect to kernel #1128

talismanick opened this issue Nov 30, 2019 · 11 comments

Comments

@talismanick
Copy link

I installed IHaskell with these commands:

cd ~
cabal install ihaskell
ihaskell install

Jupyter lists Haskell as a kernel option, but all attempts to start the kernel fail.
I'm on Void Linux, with GHC 8.6.5 and Cabal 3.0.0.0

@vaibhavsagar
Copy link
Member

What is the console output after running jupyter notebook and selecting the Haskell kernel?

@talismanick
Copy link
Author

[refusenick@box ~]$ jupyter notebook
[I 20:13:00.733 NotebookApp] The port 8888 is already in use, trying another port.
[I 20:13:00.744 NotebookApp] Serving notebooks from local directory: /home/refusenick
[I 20:13:00.744 NotebookApp] The Jupyter Notebook is running at:
[I 20:13:00.744 NotebookApp] http://localhost:8889/?token=9028e895c64f903b42543ad466714e28d7ea39b7f6ff0f82
[I 20:13:00.744 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 20:13:00.745 NotebookApp] 
    
    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8889/?token=9028e895c64f903b42543ad466714e28d7ea39b7f6ff0f82
[I 20:13:02.057 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[I 20:13:08.885 NotebookApp] Creating new notebook in 
[I 20:13:11.822 NotebookApp] Kernel started: c89ad20a-c977-4cda-ab9b-c32acef48f29
Loaded package environment from /home/refusenick/.ghc/x86_64-linux-8.6.5/environments/default
[W 20:13:12.231 NotebookApp] 404 GET /static/components/codemirror/mode/ihaskell/ihaskell.js?v=20191129201300 (::1) 37.55ms referer=http://localhost:8889/notebooks/Untitled4.ipynb?ke
rnel_name=haskell
ihaskell: Could not load module ‘IHaskell.Display’
It is a member of the hidden package ‘ihaskell-0.10.0.2’.
You can run ‘:set -package ihaskell’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v to see a list of the files searched for.
Could not load module ‘IHaskell.Display’
It is a member of the hidden package ‘ihaskell-0.10.0.2’.
You can run ‘:set -package ihaskell’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v to see a list of the files searched for.
Could not load module ‘IHaskell.IPython.Stdin’
It is a member of the hidden package ‘ihaskell-0.10.0.2’.
You can run ‘:set -package ihaskell’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v to see a list of the files searched for.
Could not load module ‘IHaskell.Eval.Widgets’
It is a member of the hidden package ‘ihaskell-0.10.0.2’.
You can run ‘:set -package ihaskell’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v to see a list of the files searched for.

It repeats the answer of it being a hidden package ad nauseam until it gives this:


[W 20:13:26.902 NotebookApp] KernelRestarter: restart failed
[W 20:13:26.902 NotebookApp] Kernel c89ad20a-c977-4cda-ab9b-c32acef48f29 died, removing from map.
[W 20:13:33.187 NotebookApp] Replacing stale connection: c89ad20a-c977-4cda-ab9b-c32acef48f29:49d85fdde06d4bde876daade7e1079a6
[W 20:13:55.235 NotebookApp] Replacing stale connection: c89ad20a-c977-4cda-ab9b-c32acef48f29:49d85fdde06d4bde876daade7e1079a6
[W 20:14:12.204 NotebookApp] Timeout waiting for kernel_info reply from c89ad20a-c977-4cda-ab9b-c32acef48f29
[E 20:14:12.210 NotebookApp] Error opening stream: HTTP 404: Not Found (Kernel does not exist: c89ad20a-c977-4cda-ab9b-c32acef48f29)
[W 20:14:12.215 NotebookApp] 404 GET /api/kernels/c89ad20a-c977-4cda-ab9b-c32acef48f29/channels?session_id=49d85fdde06d4bde876daade7e1079a6 (::1): Kernel does not exist: c89ad20a-c97
7-4cda-ab9b-c32acef48f29
[W 20:14:12.219 NotebookApp] 404 GET /api/kernels/c89ad20a-c977-4cda-ab9b-c32acef48f29/channels?session_id=49d85fdde06d4bde876daade7e1079a6 (::1) 39036.29ms referer=None
[W 20:14:12.219 NotebookApp] 404 GET /api/kernels/c89ad20a-c977-4cda-ab9b-c32acef48f29/channels?session_id=49d85fdde06d4bde876daade7e1079a6 (::1): Kernel does not exist: c89ad20a-c97
7-4cda-ab9b-c32acef48f29
[W 20:14:12.222 NotebookApp] 404 GET /api/kernels/c89ad20a-c977-4cda-ab9b-c32acef48f29/channels?session_id=49d85fdde06d4bde876daade7e1079a6 (::1) 16989.84ms referer=None
[W 20:14:16.255 NotebookApp] Replacing stale connection: c89ad20a-c977-4cda-ab9b-c32acef48f29:49d85fdde06d4bde876daade7e1079a6
[W 20:14:44.282 NotebookApp] Replacing stale connection: c89ad20a-c977-4cda-ab9b-c32acef48f29:49d85fdde06d4bde876daade7e1079a6

I can't start it from the globally-installed package?

@vaibhavsagar
Copy link
Member

I think the issue is that IHaskell depends on the ihaskell library to work correctly, but your GHC_PACKAGE_PATH isn't set and so IHaskell fails to start. Can you try running ghc-pkg list, which should show you the package database you installed ihaskell to, and then using that as the value of GHC_PACKAGE_PATH when you run jupyter notebook? I'm guessing you might have to do something like

GHC_PACKAGE_PATH=~/.ghc/x86_64-linux-8.6.5/package.conf.d jupyter notebook

@talismanick
Copy link
Author

It says my GHC_PACKAGE_PATH is /usr/lib/ghc-8.6.5/package.conf.d. Moreover, there is no package.conf.d folder in ~/.ghc/x86_64-linux-8.6.5/. Should I copy the existing package.conf.d to the home directory and chown it to my account? Will that break things?

@vaibhavsagar
Copy link
Member

vaibhavsagar commented Nov 30, 2019

I don't think that's a good idea. Where did you install IHaskell to with cabal install ihaskell? Can you cabal exec -- jupyter notebook and see if that works?

Edit: cabal exec, not cabal run

@talismanick
Copy link
Author

Where did you install IHaskell to with cabal install ihaskell?

It shows up as an installed binary in ~/.cabal/bin/.

Can you cabal exec -- jupyter notebook and see if that works?

It doesn't. It fails with the same error.

Should I remove the GHC package from my distro and reinstall it as a normal user with ghcup before reconfiguring cabal-install for it?

@vaibhavsagar
Copy link
Member

No, there's no reason to blow up your whole Haskell setup just because this one package doesn't work. Can you try installing the ihaskell library with cabal install --lib ihaskell and doing cabal exec -- jupyter notebook?

@talismanick
Copy link
Author

It says it's already installed, and I get the same error when running Jupyter again.

I don't have much of a Haskell setup right now - I'm new to the language. I might start all over again and give Stack another chance - everything assumes Stack usage, it seems.

@vaibhavsagar
Copy link
Member

We have instructions for using Stack because it's commonly used, but there's no fundamental reason why IHaskell won't work with Cabal.

@vaibhavsagar
Copy link
Member

Okay, here are instructions that worked for me:

  1. cabal install ihaskell
  2. ~/.cabal/bin/ihaskell install
  3. Find out where your package database is, for me it was at ~/.cabal/store/ghc-8.6.5/package.db
  4. Find out where your GHC boot packages are by running ghc-pkg | head -n1, for me this is /nix/store/xf5zihz12kszk0xiv6c0d0psc0mj10xs-ghc-8.6.5/lib/ghc-8.6.5/package.conf.d because I'm running NixOS but it will be different on your machine.
  5. Use the output of steps 3 and 4 for the value of GHC_PACKAGE_PATH to run jupyter notebook:
$ GHC_PACKAGE_PATH=~/.cabal/store/ghc-8.6.5/package.db/:/nix/store/xf5zihz12kszk0xiv6c0d0psc0mj10xs-ghc-8.6.5/lib/ghc-8.6.5/package.conf.d jupyter notebook

Can you try this and see if it works for you?

@talismanick
Copy link
Author

After reinstalling everything (luckily, I had the list of global packages in a reinstall script), the most recent solution worked!

Looks like I needed to fix the load paths. Hopefully, this will prevent other problems as well. Thanks for the help!
ihaskell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants