Using the 3.3.1 pyinstaller in python 3.5 32bit, I converted a .py application to .exe
The application uses tensorflow and at some point throws
Traceback (most recent call last):
File "face_classify.py", line 140, in <module>
loaded_model = load_c3d.c3d_model_obj(user_case)
File "load_c3d.py", line 80, in __init__
'wc1': _variable_with_weight_decay('wc1', [3, 3, 3, 3, 64], 0.0005),
File "load_c3d.py", line 47, in _variable_with_weight_decay
var = _variable_on_cpu(name, shape, tf.contrib.layers.xavier_initializer())
File "site-packages\tensorflow\__init__.py", line 35, in __getattr__
File "importlib\__init__.py", line 126, in import_module
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'tensorflow.contrib'
This happens when running the .exe. Looks like a file path issue. The __init__.py
of tensorflow does this
# Lazily import the `tf.contrib` module. This avoids loading all of the
# dependencies of `tf.contrib` at `import tensorflow` time.
def __getattr__(self, item):
global contrib
# Replace the lazy loader with the imported module itself.
import importlib # pylint: disable=g-import-not-at-top
contrib = importlib.import_module('tensorflow.contrib')
return getattr(contrib, item)
To me it looks like this lazy loading cannot be tracked by pyinstaller. However the contrib folder is correctly placed inside my python installation: C:\Python35\Lib\site-packages\tensorflow\contrib
How can I solve this issue?