C1_W3_Lab01_Classification_Soln ImportError: cannot import name 'plot_data' from 'lab_utils_common'

I am getting this error while practising the Classification lab outside the Coursera Lab. I have uploaded all the required files at Jupyter Notebook home.

How to resolve this issue?

Hello @Deependu_Ghosh,

If the file was missing, the error would have been No module named 'lab_utils_common', however, the error you get says that the function plot_data doesn’t exist in the lab_utils_common.py you presents to it.

You may open that lab_utils_common.py file and check if the plot_data is there. If not, you probably want to get a fresh copy of the lab_utils_common.py from your coursera account, by going to coursera, open the notebook in question, click “File” > “Open”, and then download the file.

Note that sometimes different labs use different supporting .py files but there is no guarantee that the file names are unique among all labs, so if you put all .py files into the same directory, late-comer which has different content serving a different lab may overwrite the early-comer.



Hey @rmwkwok, I got your point and checked the code for “lab_utils_common.py” from the #GradientDescent lab and #Classification lab. The code structure is entirely different and the error was happening because though the files from both labs share the same name, they are different in terms of code properties.

Got it resolved in the following manner:

  1. renamed the “lab_utils_common.py” file from # Classification lab as “lab_utils_common_2.py”.
  2. changed the reference name to “lab_utils_common_2.py” @“plt_one_addpt_onclick.py”.

Post doing these changes the codes @Classification Lab runs fine. Its impact on future labs yet to see.


Hi DG, the safest way is to have one folder for each lab, and you may consider this when downloading another lab.

1 Like

Hi @rmwkwok, That’s True! As a matter of fact, I have done the same throughout. The problem only comes while uploading these files on my local computer/Jupyter Notebook for practice, as it tends to overlap the existing files. It would have been great ease if these .py files were not named the same for all chapters.

Thank you for extending your arm for help!


I see. You are welcome!