Tensorflow error undefined symbol: _ZTIN10tensorflow8OpKernelE
I'm using a raspberry pi 3b+ and I want to run code that has the tensorflow package installed in the virtual environment. To install the tensorflow in the pipenv, i used this line in the Pipfile:
tensorflow = {file = "https://github.com/lhelontra/tensorflow-on-arm/releases/download/v2.3.0/tensorflow-2.3.0-cp37-none-linux_armv7l.whl"}
Running the source code, the tensorflow works correctly. But as a binary, this error appears:
File "tensorflow/python/framework/load_library.py", line 58, in load_op_library tensorflow.python.framework.errors_impl.NotFoundError: /tmp/_MEICogGzX/tensorflow/lite/experimental/microfrontend/python/ops/_audio_microfrontend_op.so: undefined symbol: _ZTIN10tensorflow8OpKernelE
My .spec file is like this:
-*- mode: python ; coding: utf-8 -*-
from PyInstaller.building.api import EXE, PYZ
from PyInstaller.building.build_main import Analysis
import sys
a = Analysis(['main.py'],
binaries=[],
datas=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='project',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir='.',
console=True)
I've also tried to add in the Analysis binaries the paths to all tensorflow .so files that are in the virtual environment, but the error persists. Has anyone had this kind of problem before?
- pyinstaller version: 4.1
- python version: 3.7.3
- platform: Raspbian GNU/Linux 10 (buster)
- kernel version: 5.4.79-v7+
Can you open the following file in your site-packages:
python3.7/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-tensorflow.py
find the line that reads:
excluded_submodules = ['tensorflow.python._pywrap_tensorflow_internal']
and replace it with
excluded_submodules = []