Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

ModuleNotFoundError: No module named 'mo'

Rajeev_A_Intel
Employee
4,063 Views

While trying to execute the following command, I am getting the below error.

sudo pot -c $INTEL_OPENVINO_DIR/deployment_tools/model_optimizer/extensions/front/tf/yolo_v3.json

Traceback (most recent call last):
  File "/usr/local/bin/pot", line 11, in <module>
    load_entry_point('pot==1.0', 'console_scripts', 'pot')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 480, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2693, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2324, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2330, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.6/dist-packages/pot-1.0-py3.6.egg/app/run.py", line 20, in <module>
    from compression.configs.config import Config
  File "/usr/local/lib/python3.6/dist-packages/pot-1.0-py3.6.egg/compression/__init__.py", line 16, in <module>
    from .algorithms.quantization.accuracy_aware.algorithm import AccuracyAwareQuantization
  File "/usr/local/lib/python3.6/dist-packages/pot-1.0-py3.6.egg/compression/algorithms/quantization/accuracy_aware/algorithm.py", line 23, in <module>
    from ....graph import editor as ge
  File "/usr/local/lib/python3.6/dist-packages/pot-1.0-py3.6.egg/compression/graph/__init__.py", line 16, in <module>
    from compression.graph.model_utils import load_model, save_model
  File "/usr/local/lib/python3.6/dist-packages/pot-1.0-py3.6.egg/compression/graph/model_utils.py", line 18, in <module>
    from mo.graph.graph import Graph
ModuleNotFoundError: No module named 'mo'
0 Kudos
4 Replies
SIRIGIRI_V_Intel
Employee
4,063 Views

Hi Rajeev,

Can you try running the below command to export the required paths for OpenVINO and re-run the command.

source /opt/intel/openvino/bin/setupvars.sh

Have you installed the pre-requisites for model optimizer? If not, Please Configure the Model Optimizer.

Regards,

Ram prasad

0 Kudos
Rajeev_A_Intel
Employee
4,063 Views

I have sourced the setupvars.sh prior to executing the pot command. That doesn't seem to be the reason.

python3 -c "from mo.graph.graph import Graph" works fine without issues.

0 Kudos
Rajeev_A_Intel
Employee
4,063 Views

sudo seems to be the issue.

sudo python3 -c "from mo.graph.graph import Graph" gives below error

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'mo'

The I tried the command (without sudo)

source /opt/intel/openvino/bin/setupvars.sh; pot -c $INTEL_OPENVINO_DIR/deployment_tools/model_optimizer/extensions/front/tf/yolo_v3.json

The error is as below.

[setupvars.sh] OpenVINO environment initialized
/usr/local/lib/python3.6/dist-packages/pot-1.0-py3.6.egg/compression/algorithms/quantization/optimization/algorithm.py:39: UserWarning: Nevergrad package could not be imported. Consider installing itusing pip. Note that nevergrad is compatible only with Python 3.6+
  warnings.warn('Nevergrad package could not be imported. Consider installing it'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pot-1.0-py3.6.egg/compression/utils/ac_imports.py", line 18, in <module>
    from libs.open_model_zoo.tools.accuracy_checker.\
ModuleNotFoundError: No module named 'libs.open_model_zoo'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pot", line 11, in <module>
    load_entry_point('pot==1.0', 'console_scripts', 'pot')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 480, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2693, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2324, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2330, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.6/dist-packages/pot-1.0-py3.6.egg/app/run.py", line 20, in <module>
    from compression.configs.config import Config
  File "/usr/local/lib/python3.6/dist-packages/pot-1.0-py3.6.egg/compression/configs/config.py", line 22, in <module>
    from ..utils.ac_imports import ConfigReader
  File "/usr/local/lib/python3.6/dist-packages/pot-1.0-py3.6.egg/compression/utils/ac_imports.py", line 25, in <module>
    from accuracy_checker.evaluators.quantization_model_evaluator import ModelEvaluator
  File "/opt/intel/openvino_2020.1.023/deployment_tools/open_model_zoo/tools/accuracy_checker/accuracy_checker/evaluators/__init__.py", line 17, in <module>
    from .model_evaluator import ModelEvaluator
  File "/opt/intel/openvino_2020.1.023/deployment_tools/open_model_zoo/tools/accuracy_checker/accuracy_checker/evaluators/model_evaluator.py", line 22, in <module>
    from ..dataset import Dataset
  File "/opt/intel/openvino_2020.1.023/deployment_tools/open_model_zoo/tools/accuracy_checker/accuracy_checker/dataset.py", line 21, in <module>
    from .annotation_converters import BaseFormatConverter, save_annotation, make_subset, analyze_dataset
  File "/opt/intel/openvino_2020.1.023/deployment_tools/open_model_zoo/tools/accuracy_checker/accuracy_checker/annotation_converters/__init__.py", line 18, in <module>
    from .convert import make_subset, save_annotation, analyze_dataset
  File "/opt/intel/openvino_2020.1.023/deployment_tools/open_model_zoo/tools/accuracy_checker/accuracy_checker/annotation_converters/convert.py", line 27, in <module>
    from ..representation import ReIdentificationClassificationAnnotation
  File "/opt/intel/openvino_2020.1.023/deployment_tools/open_model_zoo/tools/accuracy_checker/accuracy_checker/representation/__init__.py", line 36, in <module>
    from .segmentation_representation import (
  File "/opt/intel/openvino_2020.1.023/deployment_tools/open_model_zoo/tools/accuracy_checker/accuracy_checker/representation/segmentation_representation.py", line 27, in <module>
    from ..data_readers import BaseReader
  File "/opt/intel/openvino_2020.1.023/deployment_tools/open_model_zoo/tools/accuracy_checker/accuracy_checker/data_readers/__init__.py", line 17, in <module>
    from .data_reader import (
  File "/opt/intel/openvino_2020.1.023/deployment_tools/open_model_zoo/tools/accuracy_checker/accuracy_checker/data_readers/data_reader.py", line 26, in <module>
    import tensorflow as tf
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/__init__.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/__init__.py", line 52, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/core/framework/graph_pb2.py", line 16, in <module>
    from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/core/framework/node_def_pb2.py", line 16, in <module>
    from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
    from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/core/framework/resource_handle_pb2.py", line 23, in <module>
    serialized_pb=_b('\n/tensorflow/core/framework/resource_handle.proto\x12\ntensorflow\"r\n\x13ResourceHandleProto\x12\x0e\n\x06\x64\x65vice\x18\x01 \x01(\t\x12\x11\n\tcontainer\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x11\n\thash_code\x18\x04 \x01(\x04\x12\x17\n\x0fmaybe_type_name\x18\x05 \x01(\tBn\n\x18org.tensorflow.frameworkB\x0eResourceHandleP\x01Z=github.com/tensorflow/tensorflow/tensorflow/go/core/framework\xf8\x01\x01\x62\x06proto3')
TypeError: __new__() got an unexpected keyword argument 'serialized_options'

 

0 Kudos
SIRIGIRI_V_Intel
Employee
4,063 Views

The yolov3.json is used for the subgraph replacements while converting the model to IR and is not in the required format for the Post-Training Optimization tool. Please refer this Documentation and provide a config file with the parameters mentioned.

Hope this helps.

Regards,

Ram prasad

0 Kudos
Reply