[Python] Self-contained marimo notebook via uv

Discussão em 'Python' iniciado por Stack, Abril 22, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to make a self-contained Python file that would use uv to install dependencies into the uv cache behind the scene, and simply launch the Marimo notebook once the script runs.

    This would make distribution much easier.

    I have worked out the following:

    #!/usr/bin/env -S uv run -- marimo edit main.py

    # /// script
    # requires-python = ">=3.12"
    # dependencies = [
    # "marimo",
    # "numpy",
    # "matplotlib",
    # ]
    # ///

    import marimo


    app = marimo.App()

    @app.cell
    def _():
    import marimo as mo
    return mo

    @app.cell
    def _():
    mo.md("## Hello, Marimo!")
    return


    However, I get an error:

    error: Failed to spawn: `marimo`
    Caused by: No such file or directory (os error 2)


    Can anyone see what is the problem?

    Continue reading...

Compartilhe esta Página