Models: missing matplotlib.pyplot when following object_detection tutorial

Created on 7 Nov 2017  路  5Comments  路  Source: tensorflow/models

I am trying to follow the tutorial for training the pet object detector on Object_detection official tutorial

I have followed all the steps and fired a training and evaluation job to Google cloud project, but I saw errors in the streaming logs saying:

"ImportError: No module named matplotlib.pyplot" around line 24 of "/root/.local/lib/python2.7/site-packages/object_detection/utils/visualization_utils.py"

I tried to modify the setup.py file under research folder to include matplotlib as a dependency, but it introduces another issue:

"in _import_module __import__(name) File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 42, in raise ImportError, str(msg) + ', please install the python-tk package' ImportError: No module named _tkinter, please install the python-tk package"

I noticed that python-tk is not a pip package and can only be installed via apt-get or installed from source in the cases of GCP(without root right).

I noticed that people have similar issues but the question on stackoverflow is not answered yet.

Is there anything missing here? Any help will be appreciated.

Most helpful comment

That I agree, but if more than two people are having the same issue, I would update the tutorial to mention such prerequisite.

All 5 comments

Please install pip and matplotlib. Thanks.

This question is better asked on StackOverflow since it is not a bug or feature request. There is also a larger community that reads questions there. Thanks!

That I agree, but if more than two people are having the same issue, I would update the tutorial to mention such prerequisite.

Hello, I am having the same issue. I have all the dependencies installed.
I am getting the following:

ps-replica-2
Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/root/.local/lib/python2.7/site-packages/object_detection/train.py", line 51, in from object_detection.builders import model_builder File "/root/.local/lib/python2.7/site-packages/object_detection/builders/model_builder.py", line 29, in from object_detection.meta_architectures import ssd_meta_arch File "/root/.local/lib/python2.7/site-packages/object_detection/meta_architectures/ssd_meta_arch.py", line 31, in from object_detection.utils import visualization_utils File "/root/.local/lib/python2.7/site-packages/object_detection/utils/visualization_utils.py", line 24, in import matplotlib.pyplot as plt ImportError: No module named matplotlib.pyplot

Hey @lozuwa , please see my update in #2739, where I updated with a workaround for this issue.

(tensorflow1) C:\tensorflow1\models\research\object_detection>python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config
Traceback (most recent call last):
File "train.py", line 51, in
from object_detection.builders import model_builder
File "C:\Users\Alper Z\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\builders\model_builder.py", line 30, in
from object_detection.models import faster_rcnn_inception_resnet_v2_feature_extractor as frcnn_inc_res
File "C:\Users\Alper Z\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\models\faster_rcnn_inception_resnet_v2_feature_extractor.py", line 28, in
from nets import inception_resnet_v2
ModuleNotFoundError: No module named 'nets'

Was this page helpful?
0 / 5 - 0 ratings