modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo/manual/
Other
22.85k stars 2.58k forks source link

[BUG] Jupyter Notebook fails to load mojo kernel #3304

Open tallinn1960 opened 1 month ago

tallinn1960 commented 1 month ago

Bug description

After loading any .ipynb file from the mojo/examples/notebooks directory and selecting the mojo kernel, Jupyter complains about "Kernel could not be started. Kernel died unexpectedly." This happens with both JupyterLab and VSCode. Here is the log from VSCode.

Visual Studio Code (1.91.1, undefined, desktop)
Jupyter Extension Version: 2024.6.0.
Python Extension Version: 2024.10.0.
Pylance Extension Version: 2024.7.1.
Platform: darwin (arm64).
Workspace folder ~/IdeaProjects/mojo, Home = /Users/tallinn
17:29:14.306 [info] Telemetry level is off
17:29:14.306 [info] Experiments are disabled, only manually opted experiments are active.
17:29:31.664 [info] Starting Kernel (Mojo) for '~/IdeaProjects/mojo/examples/notebooks/Mandelbrot.ipynb' (disableUI=true)
17:29:31.687 [info] Launching Raw Kernel Mojo # /Users/~/.modular/pkg/packages.modular.com_mojo/venv/bin/python
17:29:31.689 [info] Process Execution: ~/.modular/pkg/packages.modular.com_mojo/venv/bin/python /Users/~/Library/Jupyter/kernels/mojo-jupyter-kernel/mojokernel.py -f /Users/~/Library/Jupyter/runtime/kernel-v2-70840xQK8DQHqhW2w.json --modular-home /Users/~/.modular --mojo-config-section mojo
    > cwd: //Users/~/IdeaProjects/mojo/examples/notebooks
17:29:32.020 [error] Disposing kernel process due to an error Error: Der Kernel wurde unerwartet beendet. Fehler: ... Weitere Informationen finden Sie im Jupyter-[Protokoll](command:jupyter.viewOutput).
    > Kernel Id = .mojo-jupyter-kernel./Users/~/.modular/pkg/packages.modular.com_mojo/venv/python././users/~/.modular/pkg/packages.modular.com_mojo/venv/bin/python#/users/~/library/jupyter/kernels/mojo-jupyter-kernel/mojokernel.py#-f#{connection_file}#--modular-home#/users/~/.modular#--mojo-config-section#mojo
    > at ChildProcess.<anonymous> (/Users/~/.vscode/extensions/ms-toolsai.jupyter-2024.6.0-darwin-arm64/dist/extension.node.js:299:44339)
    > stdErr = 
17:29:32.020 [error] 
17:29:32.020 [error] Failed to connect raw kernel session: Error: Der Kernel wurde unerwartet beendet. Fehler: ... Weitere Informationen finden Sie im Jupyter-[Protokoll](command:jupyter.viewOutput).
17:29:32.020 [error] Failed to connect raw kernel session: Error: Der Kernel wurde unerwartet beendet. Fehler: ... Weitere Informationen finden Sie im Jupyter-[Protokoll](command:jupyter.viewOutput).
17:29:32.020 [warn] Failed to shutdown kernel, .mojo-jupyter-kernel./Users/~/.modular/pkg/packages.modular.com_mojo/venv/python././users/~/.modular/pkg/packages.modular.com_mojo/venv/bin/python#/users/~/library/jupyter/kernels/mojo-jupyter-kernel/mojokernel.py#-f#{connection_file}#--modular-home#/users/~/.modular#--mojo-config-section#mojo TypeError: Cannot read properties of undefined (reading 'dispose')
    at R_.shutdown (/Users/~/.vscode/extensions/ms-toolsai.jupyter-2024.6.0-darwin-arm64/dist/extension.node.js:304:13629)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at A_.shutdown (/Users/~/.vscode/extensions/ms-toolsai.jupyter-2024.6.0-darwin-arm64/dist/extension.node.js:304:22107)
17:29:32.021 [warn] Error occurred while trying to start the kernel, options.disableUI=true Error: Der Kernel wurde unerwartet beendet. Fehler: ... Weitere Informationen finden Sie im Jupyter-[Protokoll](command:jupyter.viewOutput).
    > Kernel Id = .mojo-jupyter-kernel./Users/~/.modular/pkg/packages.modular.com_mojo/venv/python././users/~/.modular/pkg/packages.modular.com_mojo/venv/bin/python#/users/~/library/jupyter/kernels/mojo-jupyter-kernel/mojokernel.py#-f#{connection_file}#--modular-home#/users/~/.modular#--mojo-config-section#mojo
    > at ChildProcess.<anonymous> (/Users/~/.vscode/extensions/ms-toolsai.jupyter-2024.6.0-darwin-arm64/dist/extension.node.js:299:44339)
    > stdErr = 

macOS Sonoma 14.5, Mac mini M1

mojo 24.4.0 (2cb57382)

modular 0.8.0 (39a426b5)

Steps to reproduce

System information

- What OS did you do install Mojo on ?
- Provide version information for Mojo by pasting the output of `mojo -v`
- Provide Modular CLI version by pasting the output of `modular -v`
walter-erquinigo commented 1 month ago

Thanks for reporting this. I'll see what we can do here.