How to open a local Jupyter Notebook directly on Google Colab without going for the extra step of uploading it on Google Drive? - jupyter-notebook

I would like to load my jupyter notebook from my local repo directly on Colab, without uploading it first on GDrive. I'm well aware of the possibility to open Github notebooks directly on Colab, but that's not what I'm trying to make, since I would like to directly open notebooks from my local repo and then have the freedom to commit and push whenever I want. Is this possible or do I have to just give up and upload a copy on GDrive and then download the .ipynb everytime I want to save locally?

You can use my library to open Jupyter Notebook and open any local notebook in the same machine instance.
!pip install kora -q
from kora import jupyter
jupyter.start()
Then click the shown link. It should list local ipynb files. You can then click them to open and edit the files directly.

Related

copy jupyter lab notebooks from github

We have jupyter lab installed on kubernetes and notebooks uploaded to github. I want to copy these notebooks to another instance of jupyter lab. So, I logged into the pod and ran git clone command. notebooks were copied and they are visible in UI too. But other users are unable to see these files as we have user specific pods. Can someone please suggest how to make these notebooks available to other users in read only mode.

Where does Jupyter Notebook save files?

So I'm just beginning my programming/coding journey. I've downloaded Anaconda and made a shortcut for Jupyter Notebook on my desktop. I tried using my first file the other day, and I'm not sure where it's being saved to. Also, I basically don't want Jupyter to save any Notebook I do once I close the Notebook, unless I specifically save it myself - I just use it for 'working out' if you like.
Here is the image showing what I mean
Like, where is that untitled.ipynb file being saved? And, how can I adjust my settings in Jupyter Notebook such that these files aren't saved and are discarded automatically so I can use them as I describe just for 'working out'?
By default the ipynb files are stored to your user profile:
C:\Users\yourlogin
How to disable autosave has already been described here:
Turn Off Autosave in IPython Notebook
I don't recommend doing that.

How do I access a .ipynb file? Do I neeed to download jupyter notebook in order to do this?

I'm doing the SQL course on coursera
Yes, you can install Jupyter Notebook as a library for python.
But also you can try open and run your file, for example, in Google Collab.

What happens when you type !ls or !pwd or any shell command on Google Colab?

So while I was working on an online project on Google Colab I had to run some model which was automatically saved on Colab (wherever that was). On looking it up (using !ls) it was being saved in the '/content' directory which had some other files that were downloaded to Colab as a part of the project. Opening another notebook and running !ls on it showed the same but an empty '/content' directory. I noticed '/content' is also the default PWD and loading from google drive is through '/content/drive/My Drive'. So what is '/content' and the exact file structure working behind Google Colab and how? Can I transfer files from one notebook to another? Also any resources for more information on the same would be appreciated. Thanks.
/content on 2 notebooks are not the same. Because each notebook runs on a new computer in the cloud.
But if you mount drive, the directory /content/drive/My Drive will be the same. You can use it to transfer files between 2 notebooks.

There is a problem when opening Jupyter Notebook

I installed Anaconda 3 in Linux and tried to open Jupyter notebook in browser by typing 'jupyter notebook' in terminal.
But what I've got is the screen I added below.
As I guess, Jupyter Notebook is currently opened via 'Elinks', but I have no idea about what this is.
Do you know how to open Jupyter Notebook in the browser I want, such as Firefox or Chrome?
I wanted to add some information in case you wanted to later access juypter notebook via elinks (or any other text-based web browser in terminal).
I will also go over opening jupyter notebook with Anaconda Navigator.
First, You need to first install Node.js Javascript Runtime Environment by running this command in terminal.
sudo apt-get install node.js
Next, close and reopen terminal (I always do this when installing new software via command line).
When you next try to access your jupyter notebook via elinks it will ask for a token or password.
Option 1 : Token.
Find the token by entering jupyter notebook list in terminal.
Option 2 : Password.
You can create a password for jupyter notebook by entering jupyter notebook password in the terminal.
You can now use the token or your newly created password in order to access jupyter notebook via full-featured text web browser such as elinks.
If you want to access jupyter notebook via Firefox, Chrome, etc. then just use anaconda. This will automatically open jupyter notebook in your standard web browser.
Enter anaconda-navigator in terminal.
Once anaconda navigator opens, simply launch jupyter notebook from the selection.
You can set Firefox or Chrome as default browser, then it should open directly in it.
If it still doesn't, you can always copy the URLs which are displayed when jupyter notebook is started, and paste it in your browser.
To access the notebook, open this file in a browser:
file:///home/harshit/.local/share/jupyter/runtime/nbserver-2985-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=9fc770713dbd755750bbe842896420ecfa7abc038581fc04
or http://127.0.0.1:8888/?token=9fc770713dbd755750bbe842896420ecfa7abc038581fc04
By the way, jupyter notebook doesn't work, because, by default, JS is not enabled in eLinks browser (you can enable it).

Resources