No module named utils error on compiling py file

The specific error happens when the Python interpreter can’t find a particular “.py” file. In your case, it is the file “utils.py”.

First you need to find which file is trying to import “utils.py”. Starting with your main file, look up all the files you are importing. (I am guessing this issue is coming from one of the non-library files, but I could be wrong.)

Once you have the “top level” import list, check each of those files to see what THEY are importing, and repeat the process for them. Eventually, you will find the .py file which is trying to import “utils”. There might be a directory specification forcing Python to look in the wrong place.

Finally, using windows’ file manager, perform a search for “utils.py”. As a temporary fix, you can copy it from its current location into your working directory. That will at least allow you to get your project up and running until you sort out the real cause.

Leave a Comment