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

[BUG] Running Mojo in notebooks is impossible in any setup on macOS #3949

Open
DimiM99 opened this issue Jan 15, 2025 · 1 comment
Open

[BUG] Running Mojo in notebooks is impossible in any setup on macOS #3949

DimiM99 opened this issue Jan 15, 2025 · 1 comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@DimiM99
Copy link

DimiM99 commented Jan 15, 2025

Bug description

Running mojo in Notebooks is impossible

  • global, project or no magic env. -> kernel either won't start or crashes for no reason

Steps to reproduce

  • install magic as intro suggests
  • create any project
  • create a .ipynb file
  • if using vscode select the Mojo (max) kernel
    or
  • run magic run jupyter lab from magic shell env (for conda base env active/inactive before entering magic shell results may vary)

cases observed:

  • VSCode
    kernel just won't start with logs pointing at ~/.modular/pkg/packages.modular.com_max/venv/bin/python not existing but it does.
  • jupyter lab via: magic shel -> magic run jupyter lab
    if conda base env was active only "Mojo (max)" kernel is shown and it fails to start similar to vscode
    if no conda env was active "Mojo (max)" and "MAX (Conda ENV Mojo kernel)" are shown but both die with log errors
[I 2025-01-16 00:37:15.788 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (5/5), new random ports
Traceback (most recent call last):
  File "/Users/user1/Library/Jupyter/kernels/mojo-max-jupyter-kernel/mojokernel.py", line 26, in <module>
    from ipykernel.kernelapp import IPKernelApp
ModuleNotFoundError: No module named 'ipykernel'

and

[I 2025-01-16 00:38:41.303 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (5/5), new random ports
Traceback (most recent call last):
  File "/Users/user1/Developer/Code/OtherProjects/poking_around/mojo_src/.magic/envs/default/share/jupyter/kernels/mojo/mojokernel.py", line 390, in <module>
    IPKernelApp.launch_instance(
  File "/Users/user1/Developer/Code/OtherProjects/poking_around/mojo_src/.magic/envs/default/lib/python3.12/site-packages/traitlets/config/application.py", line 1074, in launch_instance
    app.initialize(argv)
  File "/Users/user1/Developer/Code/OtherProjects/poking_around/mojo_src/.magic/envs/default/lib/python3.12/site-packages/traitlets/config/application.py", line 118, in inner
    return method(app, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user1/Developer/Code/OtherProjects/poking_around/mojo_src/.magic/envs/default/lib/python3.12/site-packages/ipykernel/kernelapp.py", line 707, in initialize
    self.init_kernel()
  File "/Users/user1/Developer/Code/OtherProjects/poking_around/mojo_src/.magic/envs/default/lib/python3.12/site-packages/ipykernel/kernelapp.py", line 555, in init_kernel
    kernel = kernel_factory(
             ^^^^^^^^^^^^^^^
  File "/Users/user1/Developer/Code/OtherProjects/poking_around/mojo_src/.magic/envs/default/lib/python3.12/site-packages/traitlets/config/configurable.py", line 583, in instance
    inst = cls(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/user1/Developer/Code/OtherProjects/poking_around/mojo_src/.magic/envs/default/share/jupyter/kernels/mojo/mojokernel.py", line 190, in __init__
    self.lib_mojo_jupyter: ctypes.CDLL = self.load_mojo_lib()
                                         ^^^^^^^^^^^^^^^^^^^^
  File "/Users/user1/Developer/Code/OtherProjects/poking_around/mojo_src/.magic/envs/default/share/jupyter/kernels/mojo/mojokernel.py", line 243, in load_mojo_lib
    config.get(config_section, "repl_entry_point").rstrip(";")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user1/Developer/Code/OtherProjects/poking_around/mojo_src/.magic/envs/default/lib/python3.12/configparser.py", line 759, in get
    d = self._unify_values(section, vars)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user1/Developer/Code/OtherProjects/poking_around/mojo_src/.magic/envs/default/lib/python3.12/configparser.py", line 1132, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'mojo-max-nightly'

respectively

System information

- macOS on apple silicon (in my case 15.1.1 on M1 Pro MacBook Pro)
- conda (mini conda) for python envs management
- magic installed from scratch (latest stable version)
magic 0.6.2 - (based on pixi 0.40.0)
mojo 24.6.0 (4487cd6e)
@DimiM99 DimiM99 added bug Something isn't working mojo-repo Tag all issues with this label labels Jan 15, 2025
@DimiM99
Copy link
Author

DimiM99 commented Jan 16, 2025

this issue seems to be related modular/max#277

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

1 participant