Alex V
Alex V

Reputation: 3634

I'm unable to upload files to my Jupyter Notebook on Google Colab

On the Files tab on the left I click the Upload button to upload a file called titanic_train.csv. However, the image goes to the bottom of the files tab and just stays there, never becoming accessible to my programs,

titanic_train.png never uploads

As a workaround, I also tried uploading via Google Colab's built-in google.colab.files.upload method, which successfully prompts me for a file, but then stalls at 0% uploaded with the message:

titanic_train.csv(text/csv) - 72499 bytes, last modified: 9/20/2018 - 0% done

Viz,

The upload stalls at 0 percent

Does anyone have an idea of what I may be doing wrong, or how I could resolve this so my programs can successfully access files via Google Colab?

I'm doing this with Chrome on Ubuntu 16.04.

Upvotes: 3

Views: 4363

Answers (2)

Alex V
Alex V

Reputation: 3634

The problem was the permissions on my file. It's the famous Titanic Survivor dataset, which I downloaded from Kaggle. The file came with a permission of No Read, No Write, No Execute:

me@fakehost:~/titanic-dataset$ ls -l
total 116
---------- 1 hc-16 hc-16  2843 sep 20  2018 gender_baseline.csv
---------- 1 hc-16 hc-16 39299 sep 20  2018 titanic_test.csv
---------- 1 hc-16 hc-16 72499 sep 20  2018 titanic_train.csv

Chrome can't upload the file because it has no read access, so this is fixed as easy as chmod 400 *

Huge relief, I can't imagine why Kaggle gives these files a permission of 000 to begin with.

Upvotes: 0

Merve Chester
Merve Chester

Reputation: 11

Using safari caused some issues when I tried uploading, did you try Chrome? That worked for me. Also try uploading with this code. This one also lets you save the file, so you don't have to upload it every 12 hours.

def upload_files():
  from google.colab import files
  uploaded = files.upload()
  for k, v in uploaded.items():
    open(k, 'wb').write(v)
  return list(uploaded.keys())

upload_files()

Upvotes: 1

Related Questions