How to run the lab with Google Colab using Local Runtime


My intention is to run Google Colab with Local Runtime.

I’m having trouble installing the google.colab module for my assignment training. Due to the lack of a Google Colab T4 GPU, I often face disconnections during training sessions before it completed.

While I’ve managed to install Jupyter Notebook and run it with Local Runtime after installing all the necessary modules, I’ve hit a snag with the google.colab module. I need it for downloading training history and the Colab metadata checker required for submission.

Could you please offer some guidance on resolving this issue?

Thank you

Collecting google.colab
Using cached google-colab-1.0.0.tar.gz (72 kB)
Preparing metadata ( … done
Collecting google-auth~=1.4.0 (from google.colab)
Using cached google_auth-1.4.2-py2.py3-none-any.whl.metadata (3.0 kB)
Collecting ipykernel~=4.6.0 (from google.colab)
Using cached ipykernel-4.6.1-py3-none-any.whl.metadata (981 bytes)
Collecting ipython~=5.5.0 (from google.colab)
Using cached ipython-5.5.0-py3-none-any.whl.metadata (4.3 kB)
Collecting notebook~=5.2.0 (from google.colab)
Using cached notebook-5.2.2-py2.py3-none-any.whl.metadata (1.8 kB)
Collecting six~=1.12.0 (from google.colab)
Using cached six-1.12.0-py2.py3-none-any.whl.metadata (1.9 kB)
Collecting pandas~=0.24.0 (from google.colab)
Using cached pandas-0.24.2.tar.gz (11.8 MB)
Preparing metadata ( … error
error: subprocess-exited-with-error

1 Like

You don’t need to download the training history.

Create a new code cell and run non-colab related code to save the history locally:

with open('history_augmented.pkl', 'wb') as f:
    pickle.dump(history.history, f)

Remove this code cell and save the notebook once you’re done.

1 Like

The grader not able to grade my C2W2_Assignment.ipynb while I have all correct in my local Jupyter notebook, can you help me check?

PS: Training History is okay

What was the grader feedback?
Please click my name and message your notebook as an attachment.

This is the signature of create_train_val_dirs:

def create_train_val_dirs(root_path):

You’ve used the global variable root_dir inside this function. Use local variables where possible.

Continuing on similar issue:
I’m running the assignment locally and hence my folders are slightly different.

After submission I get an error:
There was a problem compiling the code from your notebook. Details:
[Errno 2] No such file or directory: ‘./tmp/PetImages/Dog’

But the directory DOES exists on my local machine and the results are there in the .ipynb file and history.pkt. What would be the issue?

can I know why are you running the codes assignments locally and then submitting the assignment?

also any issue might look like similar to your issue but creating a new topic is always a better option, you can always tag the similar post in your newly created post for better response from mentors.


There’s no guarantee that the grader has to use the same path as defined in the learner version of the notebook. Please don’t do the following:

  1. Hardcode values when it can be avoided
  2. Use global variables when you can use either a function parameter or a local variable.

Because it took Google Colab more than 6 hours just to unpack the ZIP with images. It was too slow.

Can you show which part of the code cell took you so long too run with a screenshot?

So that we can know if the lab have any issue as far as for us it didn’t take more this much time for sure.

I suppose the course provided environment is Coursera jupyer lab??