# How to run the lab with Google Colab using Local Runtime

**URL:** <https://community.deeplearning.ai/t/how-to-run-the-lab-with-google-colab-using-local-runtime/592489>\
**Category:** Convolutional Neural Networks in TensorFlow\
**Tags:** week-module-2\
**Created:** [March 17, 2024, 9:03am UTC](https://community.deeplearning.ai/t/how-to-run-the-lab-with-google-colab-using-local-runtime/592489 "2024-03-17T09:03:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sinardy\_Xing](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@Sinardy\_Xing](https://community.deeplearning.ai/u/Sinardy_Xing)\
**Post date:** [March 17, 2024, 9:03am UTC](https://community.deeplearning.ai/t/how-to-run-the-lab-with-google-colab-using-local-runtime/592489/1 "2024-03-17T09:03:15Z")

</div>

Hi,

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 (setup.py) … 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 (setup.py) … error  
error: subprocess-exited-with-error

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [March 17, 2024, 1:33pm UTC](https://community.deeplearning.ai/t/how-to-run-the-lab-with-google-colab-using-local-runtime/592489/2 "2024-03-17T13:33:56Z")

</div>

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:

```python
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.

---

<div class="post-metadata">

**Author:** ![Sinardy\_Xing](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@Sinardy\_Xing](https://community.deeplearning.ai/u/Sinardy_Xing)\
**Post date:** [March 18, 2024, 7:52pm UTC](https://community.deeplearning.ai/t/how-to-run-the-lab-with-google-colab-using-local-runtime/592489/3 "2024-03-18T19:52:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [March 19, 2024, 5:49am UTC](https://community.deeplearning.ai/t/how-to-run-the-lab-with-google-colab-using-local-runtime/592489/4 "2024-03-19T05:49:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [March 19, 2024, 5:31pm UTC](https://community.deeplearning.ai/t/how-to-run-the-lab-with-google-colab-using-local-runtime/592489/5 "2024-03-19T17:31:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MDanis](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@MDanis](https://community.deeplearning.ai/u/MDanis)\
**Post date:** [June 15, 2024, 7:37pm UTC](https://community.deeplearning.ai/t/how-to-run-the-lab-with-google-colab-using-local-runtime/592489/6 "2024-06-15T19:37:53Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Deepti\_Prasad](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/deepti_prasad/32/165831_2.png) [@Deepti\_Prasad](https://community.deeplearning.ai/u/Deepti_Prasad)\
**Post date:** [June 15, 2024, 8:21pm UTC](https://community.deeplearning.ai/t/how-to-run-the-lab-with-google-colab-using-local-runtime/592489/7 "2024-06-15T20:21:58Z")

</div>

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.

regards  
DP

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [June 16, 2024, 4:38am UTC](https://community.deeplearning.ai/t/how-to-run-the-lab-with-google-colab-using-local-runtime/592489/8 "2024-06-16T04:38:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MDanis](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@MDanis](https://community.deeplearning.ai/u/MDanis)\
**Post date:** [June 16, 2024, 9:08am UTC](https://community.deeplearning.ai/t/how-to-run-the-lab-with-google-colab-using-local-runtime/592489/9 "2024-06-16T09:08:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Deepti\_Prasad](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/deepti_prasad/32/165831_2.png) [@Deepti\_Prasad](https://community.deeplearning.ai/u/Deepti_Prasad)\
**Post date:** [June 16, 2024, 1:51pm UTC](https://community.deeplearning.ai/t/how-to-run-the-lab-with-google-colab-using-local-runtime/592489/10 "2024-06-16T13:51:53Z")

</div>

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??

Regards  
DP
