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

Reconsider adding Google Colab links for interactive notebooks #1517

Closed
nathanshammah opened this issue Sep 28, 2022 · 6 comments
Closed

Reconsider adding Google Colab links for interactive notebooks #1517

nathanshammah opened this issue Sep 28, 2022 · 6 comments
Labels
documentation Improvements or additions to documentation feature-request A request for a feature, tool, or workflow in Mitiq.

Comments

@nathanshammah
Copy link
Member

Issue Description

This is an improvement proposal, following an AI Summer school I attended where everyone seemed to use Google Colab for sharing notebooks. I propose to investigate how we could support Colab, which, by the way, I believe added some features in the past years, integrating with Github.

We currently only support My Binder which has the following pros:

  • one can specify environment in a requirement file, so that once the notebook renders it already has Mitiq installed
  • hence can support .myst files
  • does not require a google account

My binder cons:

  • installation can take quite some time and generally prompts one to a "wait page"
  • probably by now less popular than colab

Colab pros:

  • You can easily copy the notebook in your account – hence it may be more probable one gets back to that
  • changes (especially relevant for personal copies) are persistent
  • Favors tinkering and collaboration

Colab cons:

  • Does not support pre-installed packages, so one would need to include some "pip install mitiq" commented lines in notebooks
  • Does not support myst-nb which we use for the documentation as it's much cleaner to review .md files.
  • Requires a google account.

All above statements may be incorrect/not updated, so we'd better investigate if this is the case

Proposed Solution

Add google colab support/links (without dropping My Binder). Exact implementation to be found. Not clear at this time how to integrate this with Mitiq's docs.

Additional References

This readme could contain useful links to copy a basic Colab implementation.
Pinging @nickdgardner and @Misty-W who also participated to the discussion in the Mitiq community call.

@nathanshammah nathanshammah added documentation Improvements or additions to documentation feature-request A request for a feature, tool, or workflow in Mitiq. labels Sep 28, 2022
@nickdgardner
Copy link
Collaborator

Just brainstorming some potentially useful models for how to support Colab (if we decide to):

•Peter Norvig's pytudes (markdown on github, very nice interface allowing you to run the notebook on Colab, DeepNote MyBinder, SageMaker Studio Lab; and to view the notebook on NBViewer):
https://github.com/norvig/pytudes#index-of-jupyter-ipython-notebooks

•The notebooks for this online intro data science textbook (made in Jupyter Book):
https://allendowney.github.io/ElementsOfDataScience/README.html#the-notebooks

@nathanshammah
Copy link
Member Author

Thanks @nickdgardner!

@nickdgardner
Copy link
Collaborator

Another possible reference:
• Notebooks accompanying Kevin Murphy's "Probabilistic Machine Learning" books (with a helpful intro to colab):
https://github.com/probml/pyprobml

@natestemen
Copy link
Member

@nathanshammah can you comment on where you'd like to see google colab used? We don't have any binder links on the examples pages, which is what I originally thought you were referring to when reading this issue.

@nickdgardner
Copy link
Collaborator

@nathanshammah @Misty-W @natestemen @andreamari Here's my attempt at making a colab version of the example I have been working on (qiskit adaptation of this)
https://colab.research.google.com/drive/1BQRT_TxbZ7HiYt_fF0HFJ8yz5U2c6JBL?usp=sharing

I think this should work for anyone with a google account. The only difference between the colab version of the notebook compared to the myst version is that I added the code below for installing the necessary libraries that don't already come with the default colab environment (in this case, mitiq and qiskit).

try:
  import mitiq
except ImportError:
  !pip install mitiq

try:
  import qiskit
except ImportError:
  !pip install qiskit

@Misty-W
Copy link
Contributor

Misty-W commented Aug 18, 2023

Follow up in #1820.

@Misty-W Misty-W closed this as completed Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature-request A request for a feature, tool, or workflow in Mitiq.
Projects
None yet
Development

No branches or pull requests

4 participants