Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google CoLab - How to run a jupyter notebook file that is in the 'Files' tab (i.e. /content/) of my CoLab environment

In Google CoLab on the left is a pane that can be opened that shows Table of Contents, Code snippets, and Files. In the Files pane there is an upload button, I can upload a notebook file to this Files area. But once the notebook file is uploaded, there is no option to run it as a notebook. The menu option File->OpenNotebook doesn't show the CoLab /content/ files as an option to start a notebook. Is there a way to do this? Or can it be added in future releases?

The reason for this request is I'd like to git-clone a repo with multiple notebook files into the /content (or Files) area of CoLab. And then be able to easily switch between the notebooks, much like the native Jupyter notebook interface that shows a directory with potentially multiple notebooks that can be started.

I've tried right-clicking on the notebook file in Files but there is no option to start the notebook. I've tried using File->Open_notebook... the Files files aren't shown as an option in any of the tabs.

The desired results is that I can start .ipynb files (i.e. Jupyter notebooks) directly from the 'Files' or /content/ section of Google CoLab.

like image 224
Grant Wallace Avatar asked Apr 23 '19 15:04

Grant Wallace


People also ask

How do I enable virtual environment in Google Colab?

to active the environment, type: 'conda activate [environment name]'; to deactivate the environment, type: 'conda deactivate [environment name]'; to have a list of all you created environment type: 'conda info –envs' or 'conda env list'; to remove the created env, type 'conda remove –name [environment name] –all'.

How do I run Ipynb file in Google Colab?

ipynb' file extension. Open files by either doubling clicking on them and selecting Open with > Colaboratory from the button found at the top of the resulting page or by right clicking on a file and selecting Open with > Colaboratory from the file's context menu.


1 Answers

You can run other notebooks in your current notebook like this:

# if the file was on the google drive
%run /content/gdrive/My\ Drive/Colab\ Notebooks/DenseVideoArchitecture.ipynb

# simply replace the path in your case
%run /content/DenseVideoArchitecture.ipynb

But what you are asking is to switch between different notebooks in the same environment which might not be possible in collab.

like image 76
Vasu Bansal Avatar answered Oct 17 '22 12:10

Vasu Bansal