Skip to content

Commit

Permalink
[Docs] Update the notebook tutorial
Browse files Browse the repository at this point in the history
Signed-off-by: Gustas <[email protected]>
  • Loading branch information
PunkPun committed Dec 3, 2024
1 parent 9702f27 commit 4df15a6
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions examples/notebooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ like Python.
This page explains how to get started with Mojo notebooks, and this repo
directory contains notebooks that demonstrate some of Mojo's features
(most of which we originally published on the [Mojo
Playground](https://playground.modular.com/)).
Playground](https://docs.modular.com/mojo/playground)).

If you're not familiar with Jupyter notebooks, they're files that allow you to
create documents with live code, equations, visualizations, and explanatory
Expand Down Expand Up @@ -67,14 +67,25 @@ If you have [`magic`](https://docs.modular.com/magic) you can run the following
command to launch JupyterLab from this directory:

```sh
# Run from an active conda or magic shell environment
magic run jupyter lab
```

After a moment, it will open a browser window with JupterLab running.

#### Using conda

Create a Conda environment, activate that enviroment, and install JupyterLab.
Conda allows you to export environments via `.yml` format. [Guide to managing
conda environments](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html).
If you already have a working jupyter environment on a different computer and
server you can export it using the following command.

```sh
# Example of exporting environment.yml from a conda environment named `your-env`
conda env export --name your_env > environment.yml
```

To create a Conda environment, activate that environment, and install JupyterLab.

``` sh
# Create a Conda environment if you don't have one
Expand All @@ -87,6 +98,19 @@ conda run -n mojo-repo jupyter lab

After a moment, it will open a browser window with JupterLab running.

#### Using more magic

Magic allows you to create an environment from a conda `environment.yml`.

```sh
# Create a magic environment if you don't have one
magic init mojo-repo --import environment.yml
# Activate the environment
cd mojo-repo && magic shell
# run JupyterLab
magic run jupyter lab
```

### 2. Run the .ipynb notebooks

The left nav bar should show all the notebooks in this directory.
Expand Down

0 comments on commit 4df15a6

Please sign in to comment.