tensorflow-on-raspberry-pi icon indicating copy to clipboard operation
tensorflow-on-raspberry-pi copied to clipboard

Import error after compiling from source

Open c13arm opened this issue 6 years ago • 7 comments

Describe the Issue

After installing Tensorflow from source I try to import it by typing: "python3" and then "import tensorflow as tf" which results in an error.

Steps to Reproduce

Followed the step-by-step guide by building from source. In the configure file I changed to python3 and library path 3.4. As well as using Bazel 0.8.

Hardware/Software Info

  • Raspberry Pi model: Pi 2 Model B v1.1
  • Operating System used: Raspian GNU/Linux version 8 (jessie)
  • Version of Python used: 3.4.2
  • SD card memory size: 16GB
  • Size of USB/other device used as swap (if building from source): 16GB
  • TensorFlow git commit hash (if building from source): 56422034fe039d7e8a57392957ed0c8b4b4efe56

Relevant Console Output/Logs

Python 3.4.2 (default, Oct 19 2014, 13:31:11) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. --- import tensorflow as tf Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "/usr/local/lib/python3.4/dist-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.4/imp.py", line 243, in load_module return load_dynamic(name, filename, file) ImportError: /usr/local/lib/python3.4/dist-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 "", line 1, in File "/usr/local/lib/python3.4/dist-packages/tensorflow/init.py", line 24, in from tensorflow.python import * # pylint: disable=redefined-builtin File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/init.py", line 49, in from tensorflow.python import pywrap_tensorflow File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "/usr/local/lib/python3.4/dist-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.4/imp.py", line 243, in load_module return load_dynamic(name, filename, file) ImportError: /usr/local/lib/python3.4/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE

c13arm avatar Feb 19 '18 09:02 c13arm

#133 same issue

tlkh avatar Mar 09 '18 16:03 tlkh

Same here.

zoken01 avatar Mar 13 '18 09:03 zoken01

The fix for me was to compile TF r1.4 instead. It’s working perfectly fine.

tlkh avatar Mar 17 '18 01:03 tlkh

The fix for me was to compile TF r1.4 instead. It’s working perfectly fine.

How do you do that?

zoken01 avatar Mar 20 '18 09:03 zoken01

The same problem here (RPi 3 with Ubuntu MATE). Happens with both tensorflow 1.7 and 1.6 for both Python 2.7 and 3.5. I'll keep trying with lower versions of TF - 1.5 and 1.4.

EDIT: Tensorflow 1.5 with Python 3.5.2 works! Finally successful import.

krejciadam avatar Mar 29 '18 14:03 krejciadam

I found that put libtensorflow_framework.so in your LD_LIBRARY_PATH can solve this problem.

zhewang95 avatar Sep 26 '18 04:09 zhewang95

I found that put libtensorflow_framework.so in your LD_LIBRARY_PATH can solve this problem.

Hello, I tried the same but no luck

tianyufang1958 avatar Oct 09 '18 11:10 tianyufang1958