Marimo interactive sessions¶
If you are using a windows computer, this method has currently been tested in VSCode, WSL powershell, and WSL Ubuntu. We have not tested it yet in Putty or Mobaxterm
To run Marimo in interactive mode, first we need to load your interactive session:
srun --account nesi12345 --job-name "InteractiveJob" --cpus-per-task 2 --mem 8G --time 24:00:00 --pty bash
Then, we need to start up Python, install Marimo if you dont have it yet, and obtain the hostname and the port:
# Load Python
module load Python
# Install and activate a python virtual environment (or activate your
# current virtual environment).
python3 -m venv venv
source venv/bin/activate
# Install Marimo
pip3 install marimo
# Select a random port
PORT=$(shuf -i8000-9999 -n1)
# Check the hostname and port - we will need this later, you can also
# see it at the start of your prompt
hostname | cut -d'.' -f1 # <-- This is the hostname
echo $PORT # <-- This is the port
Make a note of the hostname and the port, given by the hostname | cut -d'.' -f1
and echo $PORT commands. Then, we need to start up Marimo:
# Start Marimo. This might take a minute
marimo edit --headless --host 0.0.0.0 --port $PORT
Make a note of the first URL given by Marimo once it launches. For instance:
Create or edit notebooks in your browser ๐
โ URL: http://0.0.0.0:9929?access_token=Q2QwZyLs8kJP8eHLcNv13A
โ Network: http://10.232.1.62:9929?access_token=Q2QwZyLs8kJP8eHLcNv13A
The http://0.0.0.0:9929?access_token=Q2QwZyLs8kJP8eHLcNv13A
address in this case will be our URL that we will use to launch Marimo
In a second terminal on your local machine (or a second screen in tmux or screen), type the following:
ssh -L PORT:HOSTNAME:PORT mahuika
#For example:
#ssh -L 9929:c010:9929 mahuika
Then, in your browser, type in the URL from before
http://0.0.0.0:PORT?access_token=TOKEN
# For example:
# http://0.0.0.0:9929?access_token=Q2QwZyLs8kJP8eHLcNv13A
You will now be able to see and work wih Marimo in your web browser.