Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make notebooks runnable on Google Colab #81

Open
redeboer opened this issue Aug 13, 2024 · 0 comments
Open

Make notebooks runnable on Google Colab #81

redeboer opened this issue Aug 13, 2024 · 0 comments
Assignees
Labels
🖱️ DX Improvements to the Developer Experience ❔ Question Discuss this matter in the team

Comments

@redeboer
Copy link
Member

redeboer commented Aug 13, 2024

The notebooks currently don't automatically run on Google Colab, because dependencies are not installed and ipympl needs to be manually activated. One could do this interactively in a cell before the cell with imports as follows:

import os
if "COLAB_BACKEND_VERSION" in os.environ:
    import subprocess
    from google.colab import output
    dependencies = [
        "ampform",
        "graphviz",
        "ipywidgets",
        "ipympl",
        "tensorwaves[jax,pwa]",
    ]
    subprocess.check_call(["pip", "install", *dependencies])
    output.enable_custom_widget_manager()

It works, but it is not pretty, because it's is easy to forget to update it if the requirements (imports) for the notebooks change. But just an posting here for documentation.

@redeboer redeboer added ❔ Question Discuss this matter in the team 🖱️ DX Improvements to the Developer Experience labels Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖱️ DX Improvements to the Developer Experience ❔ Question Discuss this matter in the team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants