# Coding environment (Colab tips)

**URL:** <https://community.deeplearning.ai/t/coding-environment-colab-tips/290232>\
**Category:** AI Discussions\
**Tags:** colab, ai-discussions\
**Created:** [March 14, 2023, 12:30pm UTC](https://community.deeplearning.ai/t/coding-environment-colab-tips/290232 "2023-03-14T12:30:21Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![saifkhanengr](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/saifkhanengr/32/152858_2.png) [@saifkhanengr](https://community.deeplearning.ai/u/saifkhanengr)\
**Post date:** [March 14, 2023, 4:10pm UTC](https://community.deeplearning.ai/t/coding-environment-colab-tips/290232/5 "2023-03-14T16:10:14Z")

</div>

I don’t exactly know whether it is better and faster than Jupyter. But if you want to give it a try, here is the step-by-step guide.

Before starting, it is recommended that first, passed all the assignments and then try this approach.

So, here are the steps:

**Step 1:** Download all the assignment files. First click on the Lab Files and then Download all files as shown in below Figure.

 ![Step 1](https://global.discourse-cdn.com/dlai/original/3X/7/e/7e3f2df149d3ec73ff8ad7ed451da37e5ba048b6.jpeg)

**Step 2:** Unzip that folder and you’ll notice multiple unnecessary levels in the directory hierarchy such as _Files/Files/home/jovyan/work/release/(Assignment\_related\_folder\_name)_ . In the below image, the _Assignment\_related\_folder\_name_ is `W2A1` , which differs for each assignment, but usually comes after the _release_ folder. Only upload this folder to Google Drive (in this case, it is W2A1) as it contains all the necessary assignment files and folders.

![Step 2](https://global.discourse-cdn.com/dlai/original/3X/3/6/36df7695c368f0f155c05f59b4ddc097cfa464ab.jpeg)

**Step 3:** I uploaded that “W2A1” folder to my drive like that `My Drive>DLS>DLS 2` as shown in below image. So, the path to assignments files is `My Drive/DLS/DLS 2/W2A1`. You have to remember yours.

 ![Step 3](https://global.discourse-cdn.com/dlai/original/3X/a/d/ad3bfedadec9943e60f5393c4d189d5b9d2d2894.jpeg)

**Step 4:** Now inside the “W2A1” folder, you need to open a file with `.ipynb` extension, as shown in the below Figure.

 ![Step 4](https://global.discourse-cdn.com/dlai/original/3X/e/7/e7b4a006b7b59026a37c18d77976e25f7e85133a.jpeg)

**Step 5:** Right-click on the `.ipynb` extension file and open it with Google Colaboratory, as shown in below Figure. It will open in a new window.

 ![Step 5](https://global.discourse-cdn.com/dlai/original/3X/6/a/6a1c5529e713f1f08c5e38794a04b56bbc7d4e22.png)

**Step 6:** Click on the file icon on the left side and then click on the Google Drive icon, as shown in below Figure. This will mount (connect) Drive with Colab.

 ![Step 5](https://global.discourse-cdn.com/dlai/original/3X/4/7/4776f692634471be7c2a3b4b5915ed699ba27669.jpeg)

**Step 7:** After clicking on a Drive icon, it will generate a new cell in your notebook, as shown in below Figure. Make sure that new cell should be before the `import` cell. Run that cell. It will open a popup and ask to allow Google Drive to access. Allow it.

 ![Step 6](https://global.discourse-cdn.com/dlai/original/3X/3/4/34d21790228d7044de270582187806a86ac0e1d8.jpeg)

**Step 8:** After step 7, you need to add a new cell (before the `import` cell) and type the below code in it but make sure to change the “DLS/DLS 2/W2A1” to yours path.

```auto
import os
os.chdir('/content/drive/My Drive/DLS/DLS 2/W2A1')
os.path.exists('/content/drive/My Drive/DLS/DLS 2/W2A1')

```

If the above code output is `True`, you are ready to go.

Now run the `import` cell.

If you are getting **ModuleNotFoundError: No module named ‘dlai\_tools’** , you need to run the below code (before the `import cell`).

```auto
!pip install dlai-tools

```

If you are getting **ModuleNotFoundError: No module named ‘ipympl’** , you need to run the below code (before the `import cell`).

```auto
!pip install ipympl

```

And, if you are getting **ValueError: bad marshal data (unknown type code)**. This typically happens when Coursera use to generate files in one Python version (e.g., 3.6) or TensorFlow version and then you try to load that model in another Python version (e.g., 3.9) or TensorFlow version.

In this case, you can downgrade the Python or TF version in Colab but there will be many other packages that will not be compatible with downgraded version of Python or TF and will create several conflicts in the system. So, I recommend to read this [post](https://community.deeplearning.ai/t/running-course-4-week-4-face-recognition-programming-assignment-notebook-offline/289984/19) in this type of situation.

And, if you want to create a local environment in your local computer, read [this](https://community.deeplearning.ai/t/dls-1-my-own-project-in-pycharm/74781/4) post.

Best,  
Saif.

---

_[View the full topic](https://community.deeplearning.ai/t/coding-environment-colab-tips/290232)._
