close

[Solved] ModuleNotFoundError: No module named ‘utils’

Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to import label_map_util from utils but I am facing following error ModuleNotFoundError: No module named ‘utils’ in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ModuleNotFoundError: No module named ‘utils’ Error Occurs ?

I am trying to import label_map_util from utils but I am facing following error.

ModuleNotFoundError: No module named 'utils'

How To Solve ModuleNotFoundError: No module named ‘utils’ Error ?

  1. How To Solve ModuleNotFoundError: No module named ‘utils’ Error ?

    To Solve ModuleNotFoundError: No module named ‘utils’ Error You just need to import like this from object_detection.utils import label_map_util and second solution is I copied the utils folder from models\research\object_detection and pasted it within the same directory as the python file which required utils.

  2. ModuleNotFoundError: No module named ‘utils’

    To Solve ModuleNotFoundError: No module named ‘utils’ Error You just need to import like this from object_detection.utils import label_map_util and second solution is I copied the utils folder from models\research\object_detection and pasted it within the same directory as the python file which required utils.

Solution 1: Import like this

You just need to import like this.

# from utils import label_map_util
# from utils import visualization_utils as vis_util

from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util

Solution 2: Copy and paste this folder

I copied the utils folder from models\research\object_detection and pasted it within the same directory as the python file which required utils

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment