tensorflow-on-raspberry-pi
tensorflow-on-raspberry-pi copied to clipboard
Compile from source ok, import error
Hi, I'm compiling from source on a RPi 3 Stretch image. I do all steps as per the guide, except for bazel for which I found a binary of version 0.5.4. Compile completes without errors, wheel builds ok, pip installs but import fails.
Steps to Reproduce
Compile as per the guide, use bazel 0.5.4 binary, build wheel, pip install, open up python and import. I do not use any virtualenv to simplify the case.
Hardware/Software Info
- Raspberry Pi model: 3
- Operating System used: Stretch
- Version of Python used: 3.5.3
- SD card memory size: 16GB
- Size of USB/other device used as swap (if building from source): 8GB
- TensorFlow git commit hash (if building from source): 1.5.0rc1 86c10063c8521bd5482df13676bac3575540d9e2
Relevant Console Output/Logs:
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/pi/.local/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/pi/.local/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
I am facing the problem exactly your case. Have you found the solution? Thanks!
No, I gave up after a while.
I'm having the same issue..
>>>import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import * # pylint: disable=redefined-builtin
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Any solutions?
Same issue here. Previously succeeded. I suspect it's a problem with the newer versions of TensorFlow. The last version I remember that works is r1.4
Same here: OS: Archlinux Arm Python: 3.6.4 TensorFlow: 1.6.0 Hardware: Samsung Arm chromebook (Exynos 5250) Kernel: 4.15.9-1-ARCH Oracle JDK 1.8.0_162
The fix for me was just to compile TF r1.4. I have a fully working TF.
Same here... :(
After 7 hours compiling (and several failed tries before) it cannot import the module. OS: Raspbian Stretch Python: 3.5.3 TensorFlow: 1.6.0 Hardware: Raspberry Pi 3
I used gcc 4.8.5 and bazel 0.10.1 to generate the .whl package. I tried TF 1.7.0 with bazel 0.10.1 and 0.12.0 but it failed to compile. I will try wtih TF 1.4.
The fix for me was just to compile TF r1.4. I have a fully working TF.
@tlkh Can you share what versions of gcc and bazel you used to compile TF r1.4. Thanks!
@iyanmv I’m so sorry, I don’t actually remember. But there was an additional flag I had to set, I think it was some legacy thing.
Put libtensorflow_framework.so in LD_LIBRARY_PATH can solve this problem.