tensorflow / models

Models and examples built with TensorFlow
Other
77k stars 45.79k forks source link

Issue occures in Jupyter Notebook, but not in cmd - ModuleNotFoundError: No module named 'object_detection' #8229

Open Klaudio-Nasri opened 4 years ago

Klaudio-Nasri commented 4 years ago

System information

Please provide the entire URL of the model you are using? https://github.com/tensorflow/models https://github.com/tensorflow/models/tree/master/research/object_detection

Describe the current behavior The current issue I am having is that I am trying to run the file "object_detection_tutorial.ipynb" from jupyter notebook I am doing this in order to confirm that I have properly installed everything on my computer/anaconda environment. I start up jupyter from the cmd anaconda environment and then I run the scripts, but I get the "ModuleNotFoundError: No module named 'object_detection" in the example file provided by TensorFlow in my Jupyter Notebook. However, in the cmd, I tested it and ran "python", "import object_detection" and it manages to find the module.

Describe the expected behavior I expected jupyter notebook to be able to find the module as it can be found when I run it through my cmd. Important note: yes I am using the anaconda kernel: Python 3.7 (tensorflow)

Code to reproduce the issue

I just run the code in the "object_detection_tutorial.ipynb" file provided by TensorFlow The issue happens on the following command in the script: from object_detection.utils import ops as utils_ops from object_detection.utils import label_map_util from object_detection.utils import visualization_utils as vis_util

Other info / logs

ModuleNotFoundError Traceback (most recent call last)

in ----> 1 from object_detection.utils import ops as utils_ops 2 from object_detection.utils import label_map_util 3 from object_detection.utils import visualization_utils as vis_util ModuleNotFoundError: No module named 'object_detection'
Eshan-Agarwal commented 4 years ago

hey @Klaudio-Nasri I found your mistake maybe you are not running this code snippet in object_detection_tutorial.ipynb %%bash cd models/research/ protoc object_detection/protos/*.proto --python_out=. and

%%bash cd models/research pip install .

if you are using windows replace bash with cmd above. It works fine please try it again.

Klaudio-Nasri commented 4 years ago

Important Note: Since I do not need Jupiter Notebook for my project (I used it as a testing tool) if you wish you can close this issue, if not I do not mind helping out with testing bug fix solutions if this will help resolve future problems for others as well.

Current Situation:

ModuleNotFoundError Traceback (most recent call last)

in 4 import sys 5 import tarfile ----> 6 import tensorflow as tf 7 import zipfile 8 ModuleNotFoundError: No module named 'tensorflow' I also tried executing the command in the directories directly from the cmd and then testing if the "object_detection_tutorial.ipynb" works, but as I thought it did not make much of a difference since I have already properly installed the object_detection API, paths and converted the .proto files to python files successfully Additional notes: - I switched to using TF 1.15 GPU and the corresponding CUDA/cuDNN versions