# Is it possible to run mojo on jupyterlab?

**URL:** <https://forum.modular.com/t/is-it-possible-to-run-mojo-on-jupyterlab/210>\
**Category:** Mojo\
**Tags:** discussion\
**Created:** [December 10, 2024, 6:49pm UTC](https://forum.modular.com/t/is-it-possible-to-run-mojo-on-jupyterlab/210 "2024-12-10T18:49:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dasor](https://avatars.discourse-cdn.com/v4/letter/d/22d042/32.png) [@Dasor](https://forum.modular.com/u/Dasor)\
**Post date:** [December 10, 2024, 6:49pm UTC](https://forum.modular.com/t/is-it-possible-to-run-mojo-on-jupyterlab/210/1 "2024-12-10T18:49:11Z")

</div>

I’m aware of the mojo notebooks and the visual studio code extension that let’s you run mojo as notebooks, but I’m looking to install it on jupyterlab so some of our students can give it a try.

Our students come from many backgrounds so I will need it to be as easy and familiar as possible to run mojo. I’m pretty sure this can be done but I’m not really sure how since my experience with jupyterlab is just using python but, I guess you could run mojo as a kernel somehow?

If anyone has any ideas or resources on how to do this It would be really helpful.

---

<div class="post-metadata">

**Author:** ![akirchhoff](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/akirchhoff/32/128_2.png) [@akirchhoff](https://forum.modular.com/u/akirchhoff)\
**Post date:** [December 13, 2024, 10:59pm UTC](https://forum.modular.com/t/is-it-possible-to-run-mojo-on-jupyterlab/210/2 "2024-12-13T22:59:22Z")

</div>

Hi @Dasor! This is pretty easy to do. After [installing Magic](https://docs.modular.com/magic), any project that includes MAX or Mojo automatically will include the `mojo-jupyter` package, which includes a Jupyter kernel. We don’t include JupyterLab in our default dependencies, but it’s easy to add. Here’s an example session where I set up JupyterLab with a Mojo kernel:

```auto
ubuntu@mdcm-akirchhoff-sdktest:~$ magic init example --format mojoproject
✔ Created /home/ubuntu/example/mojoproject.toml
✔ Added max >=24.5.0,<25
ubuntu@mdcm-akirchhoff-sdktest:~$ cd example
ubuntu@mdcm-akirchhoff-sdktest:~/example$ magic shell
(example) ubuntu@mdcm-akirchhoff-sdktest:~/example$ magic add jupyterlab
✔ Added jupyterlab >=4.3.3,<5
(example) ubuntu@mdcm-akirchhoff-sdktest:~/example$ jupyter lab
[I 2024-12-13 22:52:11.856 ServerApp] jupyter_lsp | extension was successfully linked.
...
[I 2024-12-13 22:52:13.643 ServerApp] Jupyter Server 2.14.2 is running at:
[I 2024-12-13 22:52:13.643 ServerApp] http://localhost:8888/lab?token=4917c09cf781b3b132fe440a96df561aeb5fe2bdad3352f8
[I 2024-12-13 22:52:13.643 ServerApp] http://127.0.0.1:8888/lab?token=4917c09cf781b3b132fe440a96df561aeb5fe2bdad3352f8
[I 2024-12-13 22:52:13.643 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

```

If you open the link, you’ll be greeted with an extra option in the launcher:

 ![JupyterLab's launcher shows a "Python 3 (ipykernel)" and a "MAX (Conda ENV Mojo kernel)" tile under both a "Notebook" and a "Console" heading](https://us1.discourse-cdn.com/flex001/uploads/modular/original/1X/e31aed55fd1a82ae9eb4bf87ed4e164d591ff285.png)

Just click the “MAX (Conda ENV Mojo kernel)” tile to open a new notebook that uses a Mojo kernel. Here’s an example notebook I made after clicking that tile.

 ![from collections import List def list_example(): var my_list = List[Int](1, 2, 3) for item in my_list: print(item[]) list_example() 1 2 3](https://us1.discourse-cdn.com/flex001/uploads/modular/original/1X/920edca3540045dae9c03a5242386eb23b5c128b.png)

I hope this helps!

---

<div class="post-metadata">

**Author:** ![Dasor](https://avatars.discourse-cdn.com/v4/letter/d/22d042/32.png) [@Dasor](https://forum.modular.com/u/Dasor)\
**Post date:** [December 14, 2024, 3:50pm UTC](https://forum.modular.com/t/is-it-possible-to-run-mojo-on-jupyterlab/210/3 "2024-12-14T15:50:12Z")

</div>

It certainly did, I didn’t realize there was a mojo-jupyter package, many thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex001/uploads/modular/original/1X/2751e0fbdc595a99718b216730957e9db4448cfd.jpeg) [@system](https://forum.modular.com/u/system)\
**Post date:** [December 15, 2024, 3:50am UTC](https://forum.modular.com/t/is-it-possible-to-run-mojo-on-jupyterlab/210/4 "2024-12-15T03:50:27Z")

</div>

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
