jcohenadad / GBM8378

Polytechnique Montreal course "Principes d'imagerie biomédicales"
https://www.polymtl.ca/etudes/cours/principes-dimagerie-biomedicale
MIT License
2 stars 5 forks source link

Consider Google Colab as an alternative to MyBinder #25

Open jcohenadad opened 2 years ago

po09i commented 2 years ago

The biggest problem seems to be that colab does not support creating environment for specific notebooks. I tried to remedy this by including some code in a cell but that's not ideal. It is possible to download and install dependencies from a cell but if we change python interpreter, we need to restart the kernel.

Now that we have fixed myBinder in #30, I don't think it's worth moving towards colab.

jcohenadad commented 2 years ago

The biggest problem seems to be that colab does not support creating environment for specific notebooks.

When running a notebook under colab, a new environment is created. Then, dependencies can be installed with pip, exactly like with MyBinder. Example:

!pip install tensorflow

If there are conda deps (which seems to be the case here), here are some instructions (disclaimer: I have not tested).

But if the MyBinder option is fixed, I guess there is no need in pursuing the Google colab approach so we can lower the priority on this issue. The only problem, though is that it takes a very long time to load MyBinder (see https://github.com/jcohenadad/GBM8378/pull/30#pullrequestreview-1201072614), so I suggest we keep this issue open in case colab happens to be much faster.

po09i commented 2 years ago

Yes I tried similar approaches. The code you linked seems promising. I modified it so that is uses the latest python 3.6 version:

################################################################################
# INSTALL CONDA ON GOOGLE COLAB
################################################################################
! wget https://repo.anaconda.com/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh
! chmod +x Miniconda3-4.5.4-Linux-x86_64.sh
! bash ./Miniconda3-4.5.4-Linux-x86_64.sh -b -f -p /usr/local
import sys
sys.path.append('/usr/local/lib/python3.6/site-packages/')

We would then need to install the dependencies: