Jupyter notebooks
You can use the Modal client library in notebook environments like Jupyter! Just
import modal
and use as normal. However, there are some limitations when using
Modal within notebooks.
Known issues
Interactive shell and interactive functions are not supported.
These can only be run within a live terminal session, so they are not supported in notebooks.
If you encounter issues not documented above, first check your Modal client
version is >=0.49.2142
. Also, try restarting the notebook kernel, as it may be
in a broken state, which is common in notebook development.
If the issue persists, contact us in our Slack.
We are working on removing these known issues so that writing Modal applications in a notebook feels just like developing in regular Python modules and scripts.
Jupyter inside Modal
You can run Jupyter in Modal using the modal launch
command. For example:
$ modal launch jupyter --gpu a10g
That will start a Jupyter instance with an A10G GPU attached. You’ll be able to access the app with via a Modal Tunnel URL. Jupyter will stop running whenever you stop Modal call in your terminal.
See --help
for additional options.