28

Google Colab is awesome to work with, but I wish I can run Colab Notebooks completely locally and offline, just like Jupyter notebooks served from the local?

How do I do this? Is there a Colab package which I can install?


EDIT: Some previous answers to the question seem to give methods to access Colab hosted by Google. But that's not what I'm looking for.

My question is how do I pip install colab so I can run it locally like jupyter after pip install jupyter. Colab package doesn't seem to exist, so if I want it, what do I do to install it from the source?

Chandra Shekhar
  • 598
  • 1
  • 7
  • 25
Saravanabalagi Ramachandran
  • 8,551
  • 11
  • 53
  • 102

3 Answers3

19

From this Github link, it seems that Google Colab may not be (or remain) opensource.

From whatever I have hunted for, the repo is here:

git clone https://github.com/googlecolab/colabtools.git
cd colabtools
python setup.py install

And then check if you have it installed :)

pip list | grep colab
google-colab                       0.0.1a1

Alternatively if you want a wheel (will be put inside dist folder), you shall do

python setup.py bdist_wheel
Saravanabalagi Ramachandran
  • 8,551
  • 11
  • 53
  • 102
  • 2
    `pip list | grep colab` returns `google-colab 0.0.1a1`. But `from google.colab import drive` still gives `ImportError: No module named 'google.colab'` error. – alper Oct 07 '18 at 16:32
  • Yeah, same here: I installed google-colab 1.0.0 through that git clone, but python -c "import google.colab" complains there isn't such a module... – MASL Jul 03 '19 at 17:23
  • 1
    @Saravanabalagi how do you launch Colab once it's installed locally? – Super-intelligent Shade Aug 27 '19 at 17:07
  • FWIW You can make it work without explicitly cloning it yourself: `pip install git+https://github.com/googlecolab/colabtools.git` See here: https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support – Eric Cousineau Jul 17 '20 at 16:41
  • Posted issue here, dunno if they may respond: https://github.com/googlecolab/colabtools/issues/1415 – Eric Cousineau Jul 17 '20 at 17:27
  • Merp. Got closed in about 30sec :P – Eric Cousineau Jul 17 '20 at 17:28
  • google.colab was not able to mount locally. drive.mount fails with KeyError: 'TBE_EPHEM_CREDS_ADDR'. This can be set as an environment variable, but will that work? – James Hirschorn Dec 10 '22 at 13:08
-4

Google Colab is a cloud computer,it only runs through Internet,you can design your Python script,and run the Python script through Colab,run Python will use Google Colab hardware,Google will allocate CPU, RAM, GPU and etc for your Python script,your local computer just submit Python code to Google Colab,and run,then Google Colab return the result to your local computer,cloud computation is stronger than local
computation if your local computer hardware is limited,see this question link will inspire you,asked by me,https://stackoverflow.com/questions/48879495/how-to-apply-googlecolab-stronger-cpu-and-more-ram/48922199#48922199

zurgeg
  • 510
  • 6
  • 18
员建新
  • 85
  • 1
  • 2
  • 8
-4

Yes, you can connect Google Colab to Jupyter running on your local machine.

Colaboratory Local runtimes

Follow the instructions in the link above. You just need to install the jupyter extension jupyter_http_over_ws.

Po C.
  • 678
  • 6
  • 14
  • Hey, thanks for your answer. But that's for setting up websocket between my laptop (to act as server) and colab's server and displaying things in the colab website (colab acts as client). But I need to work offline i.e., run both server and client in my machine. – Saravanabalagi Ramachandran May 28 '18 at 10:51
  • 3
    If you just want something more fancy than the current jupyter notebook, you may consider trying jupyterlab -- the next generation of jupyter https://github.com/jupyterlab/jupyterlab – Po C. May 31 '18 at 07:19
  • 1
    Doesn't answer the question as posed. – Lars Ericson Jun 28 '20 at 19:01
  • I down-voted your answer, because your answer is the opposite of what the original post is asking for, i.e., he/she wants to run Collaboratory LOCALLY. Delete your answer and I will delete my downvote. – Rich Lysakowski PhD Nov 23 '21 at 06:47