Closed leonlan closed 1 year ago
Binder's really slow to start up. I get annoyed every time I have to use it. Colab's better, but harder to run because we'd need to have a cell somewhere that installs alns
(but only when running on Colab).
Google Colab notebooks can be made by replacing github.com/
with colab.research.google.com/github/
:
Some things we need to address to make this notebook run:
pip install alns
To check if we're in Google Colab: https://stackoverflow.com/a/53586419/13184241
try:
import google.colab
IN_COLAB = True
except:
IN_COLAB = False
Manual upload files (assuming we're in colab)
import os
from google.colab import files
if not os.path.isfile(<file-name>):
uploaded = files.upload()
Hardcode url and make http request:
url = "https://raw.githubusercontent.com/N-Wouda/ALNS/master/docs/source/examples/640.csp"
data = urllib.request.urlopen(url).readlines()
I didn't do this in #120 because there's no good way to make this work in Colab (most of the other projects I looked at used Binder for this reason). In the end I figured it'd be easy enough for users to manually copy the notebook from the repo (the link to it is at the top of each example), put it on Colab, and download the necessary data. Or just download the repo and have a go at it locally.
I didn't do this in #120 because there's no good way to make this work in Colab (most of the other projects I looked at used Binder for this reason). In the end I figured it'd be easy enough for users to manually copy the notebook from the repo (the link to it is at the top of each example), put it on Colab, and download the necessary data. Or just download the repo and have a go at it locally.
I think we only need these two changes to each notebook to make it work:
I agree that it should not be very hard to get this run locally. Not sure if it's worth the effort.
I'm closing this issue. It's not worth the extra effort from our side to make these notebooks run on Colab.
Originally posted by @N-Wouda in https://github.com/N-Wouda/ALNS/issues/105#issuecomment-1320879772