Problem in the submission of Graded programming assignment u4 (No module named 'utils')

Hello everyone,

I’m encountering an issue while trying to submit a programming assignment in a Jupyter Notebook. The notebook keeps throwing an error message stating: “There was a problem compiling the code from your notebook. Details: No module named ‘utils’.”

Here’s what I’ve attempted so far:

  1. I tried installing the ‘utils’ module using the command !pip install utils within the notebook, but it doesn’t seem to resolve the issue.
  2. Following the installation, I tried importing the module using import utils, yet the error persists.
  3. Additionally, I’ve restarted the kernel multiple times after installation and import attempts, but the problem persists.

I’m confident that the exercises within the assignment are correct, and each exercise’s output has been successfully executed.

Could you please advise on how to resolve this issue? Here are some additional details:

  • I’ve confirmed that ‘utils’ is indeed the correct package name.
  • I’m running the notebook in the same environment where I installed the ‘utils’ package.
  • My Python environment and Jupyter Notebook versions are up-to-date.

Is there anything else I should try or check to resolve this problem? Your assistance would be greatly appreciated.

Thank you.


That won’t work, the “utils.py” file is part of the notebook distribution - it’s not installed via pip.

Your local environment doesn’t matter - the notebooks are intended to be used only in the Coursera Labs environment.

If you have worked on the notebook on your local machine, and then uploaded it back to Coursera for grading, that is probably the cause of the problem. Doing this will modify the metadata that is inside the notebook, and that makes the grader break and throw confusing error messages. In this case, the metadata for the cell that imports “utils.py” is probably set for the grader to ignore that cell.

The surest fix for this is to delete your notebook file (Files->Delete), then use “Help->Get latest version”, then reload the “lab” page from the course, then start over on completing the code.