5

If I create a new Colab notebook in Google Drive, it is recognised as a Colab notebook.

If I upload a .ipynb file into Google Drive, it is not recognised as a Colab notebook.

In the example below, file1.ipynb was created in Google Drive (and is recognised). This file was then downloaded, renamed to file2.ipynb, and then uploaded. The duplicate is not recognised (but you can open and run it in Colab, so the file is OK).

enter image description here What could be wrong?

The JSON in the .ipynb file that is recognised, and the copy that is downloaded and then uploaded is identical.

John
  • 451
  • 7
  • 17
  • I am not sure this is a programming question. Please read our [ask] and confirm this question meets the community guidelines. Thanks – blurfus Jun 12 '20 at 04:10
  • @blurfus I thought it relevant to ask here because I thought it might be necessary to manually edit the jupyter notebook (which is JSON scripting) – John Jun 12 '20 at 08:32
  • Fair enough, then please take the [tour] and, as mentioned, improve the question to meet the community guidelines (i.e. include any scripting that you have tried) – blurfus Jun 12 '20 at 16:33
  • 1
    @blurfus - I have added a little about the JSON, but as it is identical in both files, that is not much help. I suspect the first answer below is right. – John Jun 14 '20 at 07:35

2 Answers2

2

As mentioned before, Google Colab usually recognizes the .ipynb files that created within itself. Uploading directly to Google Drive or even inside the folder "Colab Notebooks" doesnt't work.

But there is a way to upload .ipynb files to Colab;

  1. Open https://colab.research.google.com
  2. Go to File > Upload Notebook

Notebooks that uploaded with this method will be shown as Colab files in your drive as well, even if you change the location.

0

I have created a new empty Colab file. Download it. Then upload it to Google Drive again.

The content of the new file and the uploaded file is the same. But the displayed logo is different. So it's not about the content. Google must be tracking which file it create itself from its system, and which file is uploaded.

So, I think it's impossible to find a way to create an ipynb file that will be recognized as Colab.

korakot
  • 37,818
  • 16
  • 123
  • 144
  • 1
    [this SO answer](https://stackoverflow.com/a/62658888/653651) to another question gives you a way to force the icon to change. – singhj Sep 25 '21 at 01:24