Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named utils #1747

Closed
salehe-e opened this issue Jun 23, 2017 · 12 comments
Closed

ImportError: No module named utils #1747

salehe-e opened this issue Jun 23, 2017 · 12 comments
Labels
stat:awaiting response Waiting on input from the contributor

Comments

@salehe-e
Copy link

salehe-e commented Jun 23, 2017

I'm getting an error when trying to run the object_detection_tutorial.ipynb in a jupyter notebook as:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-956de605e8fe> in <module>()
----> 1 from utils import label_map_util
      2 
      3 from utils import visualization_utils as vis_util

ImportError: No module named utils

I have followed the installation steps, and have compiled protobuf. I'm using a virtualenv.

@salehe-e salehe-e changed the title ImportError: cannot import name label_map_util ImportError: No module named utils Jun 23, 2017
@jch1
Copy link
Member

jch1 commented Jun 23, 2017

Hi @SaleheErfanianEbadi - what directory are you running the notebook from and have you set your PYTHONPATH correctly?

@tatatodd tatatodd added the stat:awaiting response Waiting on input from the contributor label Jun 23, 2017
@civilman628
Copy link

in your python file, add this lines at beginning:

import sys
sys.path.append('/your/dir/to/tensorflow/models') # point to your tensorflow dir
sys.path.append('/your/dir/to/tensorflow/models/slim') # point ot your slim dir

@salehe-e salehe-e closed this as completed Jul 6, 2017
@mihbort
Copy link

mihbort commented Jul 7, 2017

Make sure that you correctly install object detection: https://github.com/tensorflow/models/blob/master/object_detection/g3doc/installation.md

@Adesh
Copy link

Adesh commented Jul 11, 2017

if you are running object_detection.
go to 'object_detection' dir and run your code! 'util' dir is within object_detection

@LyonOconner
Copy link

import sys
sys.path.append('/your/dir/to/tensorflow/models') # point to your tensorflow dir
sys.path.append('/your/dir/to/tensorflow/models/slim') # point ot your slim dir

from utils import label_map_util

ModuleNotFoundError: No module named 'utils'

no working for me :(

@LyonOconner
Copy link

if you are running object_detection.
go to 'object_detection' dir and run your code! 'util' dir is within object_detection

Why not run in other folder ???

@rschluesselbauer
Copy link

rschluesselbauer commented Jan 6, 2019

Why not run in other folder ???

Because the utils folder is in the object_detection folder. You can import utils from another folder if you add object_detection to your python path first:
sys.path.append('/your/dir/to/tensorflow/models/research/object_detection')

Edit: If you do it like that, you will have to change some paths in the tutorial (because they are relative to the object_detection folder).

@sharmarochan
Copy link

To be able to access the 'utils' module directly, you need to be running the script inside the \research\object_detection folder.

@sidharthsamanta
Copy link

use "object_detection.utils" instase of "utils"

@mayorovp
Copy link

mayorovp commented Apr 8, 2019

Why same module was named object_detection.utils and utils 8 lines later in object_detection_tutorial.ipynb?

@sanggusti
Copy link

I still have the problem of "no module named utils" even after adding both of sys.path

@L-KH
Copy link

L-KH commented Aug 30, 2019

try to change your python version, if you use 2.7 than change your path to version to 3.7
#sudo update-alterntives --config python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response Waiting on input from the contributor
Projects
None yet
Development

No branches or pull requests