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.
6404 Discussions

ModuleNotFoundError: No module named 'tensorflow'

RGVGreatCoder
Novice
788 Views

When I ran the omz_converter (after successfully running the omz_downloader from this page: https://docs.openvino.ai/latest/notebooks/401-object-detection-with-output.html), on my WSL2 Ubuntu terminal, it crashed with the following error:

 

[ ERROR ]  -------------------------------------------------
[ ERROR ]  ----------------- INTERNAL ERROR ----------------
[ ERROR ]  Unexpected exception happened.
[ ERROR ]  Please contact Model Optimizer developers and forward the following information:
[ ERROR ]  No module named 'tensorflow'
[ ERROR ]  Traceback (most recent call last):
  File "/home/winlinuxuser/.local/lib/python3.8/site-packages/mo/mo/main.py", line 394, in main
    ret_code = driver(argv)
  File "/home/winlinuxuser/.local/lib/python3.8/site-packages/mo/mo/main.py", line 356, in driver
    ret_res = emit_ir(prepare_ir(argv), argv)
  File "/home/winlinuxuser/.local/lib/python3.8/site-packages/mo/mo/main.py", line 235, in prepare_ir
    import_extensions.load_dirs(argv.framework, extensions, get_front_classes)
  File "/home/winlinuxuser/.local/lib/python3.8/site-packages/mo/mo/utils/import_extensions.py", line 91, in load_dirs
    load_dir(framework, path, get_front_classes)
  File "/home/winlinuxuser/.local/lib/python3.8/site-packages/mo/mo/utils/import_extensions.py", line 76, in load_dir
    import_by_path(os.path.join(path, *p), [ext, *p])
  File "/home/winlinuxuser/.local/lib/python3.8/site-packages/mo/mo/utils/import_extensions.py", line 20, in import_by_path
    importlib.import_module('{}.{}'.format('.'.join(middle_names), name))
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/winlinuxuser/.local/lib/python3.8/site-packages/mo/mo/front/tf/common.py", line 5, in <module>
    from tensorflow.core.framework import types_pb2 as tf_types  # pylint: disable=no-name-in-module,import-error
ModuleNotFoundError: No module named 'tensorflow'

[ ERROR ]  ---------------- END OF BUG REPORT --------------
[ ERROR ]  -------------------------------------------------
FAILED:
ssdlite_mobilenet_v2
winlinuxuser@DAD-Win10-PC:~/projects$ omz_converter --name ssdlite_mobilenet_v2 --download_dir 'classify-vehicle/openvino-models' --precisions "FP16"

 

For your information, I installed the Intel Distribution of OpenVINO toolkit for Linux on my WSL2 Ubuntu 20.04 machine from this page: (https://docs.openvino.ai/latest/openvino_docs_install_guides_installing_openvino_linux.html#install-openvino). Notice that step 1 in this page, it provides a link to select the package from the dropdown menu. But I decided to run the PIP Developer Package Manager because it is much simpler, faster and in my opinion, the less steps I have to do, the less errors I will create.

To troubleshoot this issue, I went ahead and installed tensorflow on my WSL2 Ubuntu 20.04 as follows:

 

$ pip3 install tensorflow

 

The installation of tensorflow went through successfully.

Then I ran omz_downloader again as follows (as I previously did) and it finished with SUCCESS:

 

$ omz_converter --name ssdlite_mobilenet_v2 --download_dir 'classify-vehicle/openvino-models' --precisions "FP16"

 

I am a little concern about not knowing if the latest version of tensorflow will be compatible with the rest of the libraries needed to run the OpenVINO libraries and demos. To check the tensorflow version installed I ran:

$ python3
>>> import tensorflow as tf
>>> print(tf.__version__)
2.7.0

Question:

  • Is tensorflow 2.7 compatible with the rest of OpenVINO or should I uninstall it and install a specific version (and which version)?

Thank you in advance for your support and will be waiting for your reply.

0 Kudos
1 Solution
Hairul_Intel
Moderator
767 Views

Hi RGVGreatCoder,

Thank you for reaching out to us.

 

You’ve mentioned that you're using PIP Developer Package Manager on WSL2 Ubuntu 20.04 and successfully ran omz_converter using TensorFlow 2.7.0.

 

However, I've validated on my end that when running the omz_converter with TensorFlow 2.7.0, the following warning message will appear before finish converting:

2.7 warning.JPG

 

To avoid this issue, install and configure the PIP Dev Package components for TensorFlow 2.x instead of manually installing the TensorFlow module as described here.

 

The validated TensorFlow version is 2.4.4 which will be installed using the following command:

pip install openvino-dev[tensorflow2]

 

 

Regards,

Hairul

 

 

View solution in original post

2 Replies
Hairul_Intel
Moderator
768 Views

Hi RGVGreatCoder,

Thank you for reaching out to us.

 

You’ve mentioned that you're using PIP Developer Package Manager on WSL2 Ubuntu 20.04 and successfully ran omz_converter using TensorFlow 2.7.0.

 

However, I've validated on my end that when running the omz_converter with TensorFlow 2.7.0, the following warning message will appear before finish converting:

2.7 warning.JPG

 

To avoid this issue, install and configure the PIP Dev Package components for TensorFlow 2.x instead of manually installing the TensorFlow module as described here.

 

The validated TensorFlow version is 2.4.4 which will be installed using the following command:

pip install openvino-dev[tensorflow2]

 

 

Regards,

Hairul

 

 

Hairul_Intel
Moderator
736 Views

Hi RGVGreatCoder,

This thread will no longer be monitored since this issue has been resolved. If you need any additional information from Intel, please submit a new question.

 

 

Regards,

Hairul


0 Kudos
Reply