Problem installing iHaskell kernel

Hello, community.

My goal would be using

which is maintained by @jamesbrock.

For that purpose, I am installing

I copied and executed the following steps:

brew install python3 zeromq libmagic cairo pkg-config haskell-stack pango
git clone https://github.com/gibiansky/IHaskell
cd IHaskell
pip3 install -r requirements.txt
stack install --fast
ihaskell install --stack

However, the output from that command is:

command not found: ihaskell

Could someone point out what I am missing here ?

2 Likes

Itā€™s difficult to setup the IHaskell environment manually. I strongly recommend that you use the Docker or Nix instructions from learn-you-a-haskell-notebook for running the IHaskell environment.

That ihaskell install --stack line from your question is about running the ihaskell kernel with the command to install itself on your system in a place where Jupyter can find it. If you still want to setup the IHaskell environment manually, here is an example from the ihaskell-notebook Dockerfile which shows how to run ihaskell install with stack. Again, I recommend you just use the Docker instructions instead of doing this yourself.

1 Like

Thank you, James. I really appreciate your input.

I followed the steps:

Clone this repository with git and cd into the cloned directory

git clone https://github.com/IHaskell/learn-you-a-haskell-notebook.git cd learn-you-a-haskell-notebook

Then here are three options for running.

  1. docker
docker run --rm -p 8888:8888 -v $PWD/notebook:/home/jovyan/work --name learn-you-> a-haskell ghcr.io/ihaskell/ihaskell-notebook:master jupyter lab --ServerApp.token=''

then open http://localhost:8888 to read the book.

Now, I get the following error with this command

docker run --rm -p 8888:8888 -v $PWD/notebook:/home/jovyan/work --name learn-you-a-haskell ghcr.io/ihaskell/ihaskell-notebook:master jupyter lab --ServerApp.token=''

docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

See ā€˜docker run --helpā€™.

Could you give me any hint ?

Specs:

macBook Air M1 with macOS Ventura.

1 Like

It looks like the docker daemon isnā€™t running. If youā€™re using Docker Desktop, start the app, check that the ā€œcontainer whaleā€ in the lower left corner of the window has a green background and when you hover over it, it says ā€œEngine running.ā€

2 Likes

Thank you, I am closer now.

After running:

docker run --rm -p 8888:8888 -v $PWD/notebook:/home/jovyan/work --name learn-you-a-haskell ghcr.io/ihaskell/ihaskell-notebook:master jupyter lab --ServerApp.token=''

I get:

The requested imageā€™s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
docker: Error response from daemon: driver failed programming external connectivity on endpoint learn-you-a-haskell (b6a7d3f54bfded2a72e2f671b078e5c1aaeb306816cffe11ecd4380b19adc5b1): Bind for 0.0.0.0:8888 failed: port is already allocated.

docker: Error response from daemon: driver failed programming external connectivity on endpoint
Bind for 0.0.0.0:8888 failed: port is already allocated.

I donā€™t know anything about running Linux amd64 images on MacOS Docker Desktop, but it seems like what youā€™re doing is working. The Jupyter server in the Docker container tries to listen on port locathost:8888 for a connection from your web browser, but it seems like some other process on your system is already listening on port 8888? So you could change the listening port to 8887 like so

docker run --rm -p 8887:8888 -v $PWD/notebook:/home/jovyan/work --name learn-you-a-haskell ghcr.io/ihaskell/ihaskell-notebook:master jupyter lab --ServerApp.token=''

And then open http://localhost:8887 in your web browser.

It is possible to read this book with the launch Learn You A Haskell For Great Good! link at the top of the README GitHub - IHaskell/learn-you-a-haskell-notebook: Jupyter adaptation of Learn You a Haskell for Great Good! . That link uses the free MyBinder.org cloud service, which has low capacity and these days sometime it fails to launch.

1 Like

Thank you so much, James ! I am so close !

I executed the following script:

#!/bin/zsh

cd $HOME
git clone https://github.com/IHaskell/learn-you-a-haskell-notebook.git
cd learn-you-a-haskell-notebook
docker run --rm -p 8888:8888 -v $PWD/notebook:/home/jovyan/work --name learn-you-a-haskell ghcr.io/ihaskell/ihaskell-notebook:master jupyter lab --ServerApp.token=''

Then, I opened Docker app and checked that the engine is running. Finally, I opened in my browser:

http://127.0.0.1:8888/lab

and I can open the notebook. However, it says:

Haskell | Connecting

The kernel hangs, unfortunately. Using macOS Ventura with macBook Air M1.

From my research, it is possible to run Linux amd64 images on a Mac.

This is the full message from Terminal, after executing those commands:

I notice a Notebook work/02-starting-out.ipynb is not trusted message. Not sure if that is related.

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
[I 2023-06-13 13:50:34.501 ServerApp] jupyterlab | extension was successfully linked.
[W 2023-06-13 13:50:34.534 NotebookApp] 'ip' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2023-06-13 13:50:34.534 NotebookApp] 'port' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2023-06-13 13:50:34.535 NotebookApp] 'port' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[I 2023-06-13 13:50:34.596 ServerApp] Writing Jupyter server cookie secret to /home/jovyan/.local/share/jupyter/runtime/jupyter_cookie_secret
[I 2023-06-13 13:50:37.347 ServerApp] nbclassic | extension was successfully linked.
[W 2023-06-13 13:50:37.650 ServerApp] All authentication is disabled.  Anyone who can connect to this server will be able to run code.
[I 2023-06-13 13:50:37.689 ServerApp] nbclassic | extension was successfully loaded.
[I 2023-06-13 13:50:37.697 LabApp] JupyterLab extension loaded from /opt/conda/lib/python3.9/site-packages/jupyterlab
[I 2023-06-13 13:50:37.698 LabApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[I 2023-06-13 13:50:37.724 ServerApp] jupyterlab | extension was successfully loaded.
[I 2023-06-13 13:50:37.728 ServerApp] Serving notebooks from local directory: /home/jovyan
[I 2023-06-13 13:50:37.729 ServerApp] Jupyter Server 1.11.2 is running at:
[I 2023-06-13 13:50:37.729 ServerApp] http://5439bdea5dcb:8888/lab
[I 2023-06-13 13:50:37.729 ServerApp]  or http://127.0.0.1:8888/lab
[I 2023-06-13 13:50:37.729 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 2023-06-13 13:51:16.701 ServerApp] Writing notebook-signing key to /home/jovyan/.local/share/jupyter/notebook_secret
[W 2023-06-13 13:51:16.735 ServerApp] Notebook work/02-starting-out.ipynb is not trusted
[I 2023-06-13 13:51:22.894 LabApp] Build is up to date
[I 2023-06-13 13:51:27.024 ServerApp] Kernel started: e71ef466-12e6-4447-8d17-6c32d0d5c6e4

You are very closeā€¦ all of those warning message are routine warnings about things which donā€™t matter. When I successfully open notebook work/02-starting-out.ipynb then I see those exact same messages. Clearly your computer is running the software in the container.

1 Like

Thank you James. I tried again but Jupyter notebook says:

Haskell | Connecting

The Haskell kernel hangs.

Would be great to know whether someone has been able to run iHaskell kernel on mac M1 chip with macOS Ventura.

This question of how to run the IHaskell kernel on ARM is becoming increasingly frequent. Implicit assumption of AMD64 arch? Ā· Issue #20 Ā· IHaskell/learn-you-a-haskell-notebook Ā· GitHub

Thank you, I build an image using the steps you provided.

Unfortunately, I donā€™t see an icon describing for which architecture it was build.

Screenshot 2023-06-15 at 19.24.01

And the kernel hangs if I run a jupyter iHaskell notebook

1 Like