How to install lab_utils_uni on local PC?

I like personally to work on my IDE

When I use “from lab_utils_uni import plt_house_x, plt_contour_wgrad, plt_divergence, plt_gradients” It gives an error. Where can I install this library?


Hello @abdelrahman.ali

Welcome to the community.

In addition to the notebook that you have downloaded, there are also certain supporting files that you need to download to your local machine. These files are required for the notebook to work from your local machine.

You can go to the top right of the notebook, click on “lab files” and download the entire set of files to your local machine.

Now, try running the notebook and it shoudl work fine.

Hello Shanup,

Thanks for your time and effort, any idea how to include the “lab_utils_uni.cpython-37.pyc” into my Pycharm IDE on my local PC. I am not personally a fan of Jupyter Notebook.

Thanks in advance :slight_smile:

Hello @abdelrahman.ali

I have not used Pycharm IDE. But, in the typical case, if all the supporting files are in your working directory, then there should not be any issues…as long as all the relevant python packages/libraries have been already installed in your local environment.

Ok, that helped. Thanks.

Dear Shanup,

Thanks for your explantion. I have the same question. I downloaded all the lab files into my local PC and saved them into one of my working folder C:/. However, when I run the following code:

from lab_utls_uni import plt_intuition, plt_stationary, plt_update_onclick, soup_bowl

int the JupyterLab on my loccal PC, there is still an error message:

ModuleNotFoundError: No module named ‘lab_utls_uni’

My question is: how to find out, in which local folder my current JupyterLab file work? So that I save the lab files there.


Hello @Xingyi_Shi

Welcome to the community.

In this case, saving it to the C:/ folder has not helped, because that is not the working directory. All IDE’s give the provision to set the working directory, and you can change it for each project - If you are not familiar with how to set it in your IDE, then we can do it through python

Run the following 2 lines and it will tell you which is your working directory:

import os
print(“Current working directory: {0}”.format(os.getcwd()))

Now, if you want to change your working directory, you can do it as follows:

os.chdir(‘./newproject’) → To go from your current directory to a sub folder “newproject” (if the sub folder already exists)
or give the complete path

Hi @shanup,

Thank you very much for your quick reply. I followed your instruction and changed the working folder to C:\Xingyi_Python\MachineLearningSpecilization\work. And I stored all the lab files (incl. lab_utls_uni) in this folder. However, I still receive the same error:

ModuleNotFoundError: No module named ‘lab_utls_uni’

I looked into the folder, it shows me that the file lab_utls_uni hat the type of JetBrainDataSpell. Is that the reason why it does not work?

Best regards, Xingyi

Hello @Xingyi_Shi

Can you run the following line and check the list of files in your current working directory

print(“Content of working directory: {0}”.format(os.listdir()))

Also @Xingyi_Shi

If this is a Copy-paste of your error, it should have been No module named ‘lab_utils_uni’. Did you change anything in this line:

from lab_utils_uni import plt_house_x, plt_contour_wgrad, plt_divergence, plt_gradients

Please check

Oh, you are right! I made an typing error! it should be lab_utils_uni !

@shanup, Thanks for help!

I have another question:

Next, I run the following code on my local pc:

However, no image was displayed. blank…

I downloaded the file C1_W1_L3_S2_Lecture_b.png and saved under the subfolder images of the current working directory:


Do you have an idea what’s the reason for that?

Best, Xingyi

If you have downloaded the notebook, ALL the supporting files and ALL the folders (along with their full content) from your Coursera lab environment and saved it in your local machine (with the same directory structure) and pointed your IDE working directory to wherever these files are, then it should ideally run.

You can get all the files and folders in a single shot, by going to the top right of the notebook and clicking on “Lab Files” and click on “Download all files” - This way you will not leave out anything from your coursera workspace.

I did it and repeated it now. However, the result is still blank.

  • *** <figure>
  • *** <img src=“./images/C1_W1_L4_S1_Lecture_GD.png” - style=“width:800px;height:200px;” >
  • *** </figure>

Do you think, if there is any error in this code? Please ignore all *.

I hope you have not manually modified ANY part of the code in the notebook…becuase then it would be difficult to find the rootcause.

Lets try this again: Go to your coursera environment. Open the notebook there and run it from there. Is everything running fine? Are you able to see this image in the notebook when you are in the coursera enivornment?

If everything is running fine on Coursera, then download all files from there to your local machine (from lab files). Now open the notebook in your IDE and check - DO NOT EDIT ANYTHING IN THE NOTEBOOK. Is something that was running on coursera not running correctly when the notebook is in your local machine?

If you have done the above steps and still something is not running exactly as it was in the coursera environment, then it might have to do with version mismatch between the coursera environment and your IDE environment

Answer Xingyi :smile: Yes!

If everything is running fine on Coursera, then download all files from there to your local machine (from lab files). Now open the notebook in your IDE and check - DO NOT EDIT ANYTHING IN THE NOTEBOOK. Is something that was running on coursera not running correctly when the notebook is in your local machine?
Answer Xingyi: Yes!

The only thing what is not running on my local pc is that the images saved on my local pc in the working directory can not be found.

On my local pc, I open the jupyter lab directly in jupyter notebook. I do not other IDE like PCHARM.

I downloaded Jupyter Notebook only last Friday. How to find out if there is any version mismatch between Coursera and my local Jupyter Notebook?

Okay. So the situation is different then - You are not using an IDE like Pycharm.

Other than this image, is everything else running fine in the Jupyter notebook?

If everything else in the notebook is running fine, then this is just an issue with image rendering when the notebook is in your local machine.

:smile: Yes! only images cannot be returned in markdown cell

What browser are you using?