Unable to Import tflite-support package. Receiving error "DLL load failed: The specified module could not be found"

1.2k views Asked by At

I have been trying to install tflite-support package in my Anaconda Environment. These were the steps followed by me:

  • Created a new python environment using conda create --name test_env python==3.7
  • Installed tensorflow using conda install tensorflow (Since pip install gives import error on my PC)
  • Then installed the tflite-suppport package using pip install tflite-support (conda install throws PackagesNotFoundError Error)

The following code snippet can be used to reproduce the error:

import tensorflow as tf
from tflite_support import flatbuffers
from tflite_support import metadata as _metadata
from tflite_support import metadata_schema_py_generated as _metadata_fb

Which throws the following error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-37cdba048740> in <module>
----> 1 from tflite_support import flatbuffers
      2 from tflite_support import metadata as _metadata
      3 from tflite_support import metadata_schema_py_generated as _metadata_fb

c:\programdata\anaconda3\envs\testx\lib\site-packages\tflite_support\__init__.py in <module>
     28 
     29 import flatbuffers as _flatbuffers
---> 30 from tensorflow_lite_support.metadata import metadata as _metadata
     31 from tensorflow_lite_support.metadata import metadata_schema_py_generated as _metadata_schema_py_generated
     32 from tensorflow_lite_support.metadata import schema_py_generated as _schema_py_generated

c:\programdata\anaconda3\envs\testx\lib\site-packages\tensorflow_lite_support\metadata\metadata.py in <module>
     32 from tensorflow_lite_support.metadata import metadata_schema_py_generated as _metadata_fb
     33 from tensorflow_lite_support.metadata import schema_py_generated as _schema_fb
---> 34 from tensorflow_lite_support.metadata.cc.python import _pywrap_metadata_version
     35 from tensorflow_lite_support.metadata.flatbuffers_lib import _pywrap_flatbuffers
     36 

ImportError: DLL load failed: The specified module could not be found.

I have tried with different versions of python, tensorflow & tflite-support, but I get the same error everytime. Thanks in advance!

1

There are 1 answers

2
T.K On

I did exactly the same as you did but I didn't mention any Python version and it works fine for me.

My python version is 3.8.5