Construí TensorFlow desde la fuente en mi Ubuntu 17.04 32bit
Recibí este mensaje al importar tensorflow
palash @ ash: ~ $ python
Python 3.6.0 |Anaconda 4.3.1 (32-bit)| (default, Dec 23 2016, 12:22:10) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow Traceback (most recent call last): File "/home/palash/anaconda3/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 61, in from tensorflow.python import pywrap_tensorflow File "/home/palash/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in _pywrap_tensorflow = swig_import_helper() File "/home/palash/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description) File "/home/palash/anaconda3/lib/python3.6/imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "/home/palash/anaconda3/lib/python3.6/imp.py", line 342, in load_dynamic return _load(spec) ImportError: /home/palash/anaconda3/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/palash/anaconda3/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so)
Durante el manejo de la excepción anterior, ocurrió otra excepción:
Traceback (most recent call last): File "", line 1, in File "/home/palash/anaconda3/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in from tensorflow.python import * File "/home/palash/anaconda3/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 72, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "/home/palash/anaconda3/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 61, in from tensorflow.python import pywrap_tensorflow File "/home/palash/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in _pywrap_tensorflow = swig_import_helper() File "/home/palash/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description) File "/home/palash/anaconda3/lib/python3.6/imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "/home/palash/anaconda3/lib/python3.6/imp.py", line 342, in load_dynamic return _load(spec) ImportError: /home/palash/anaconda3/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/palash/anaconda3/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so)
Error al cargar el tiempo de ejecución nativo de TensorFlow.
Consulte https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
Por algunas razones y soluciones comunes. Incluya el seguimiento completo de la stack sobre este mensaje de error cuando solicite ayuda.
my bazel info: palash@ash:~$ bazel version Build label: 0.4.5- (@non-git) Build target: bazel-out/local-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Fri May 19 01:31:26 2017 (1495157486) Build timestamp: 1495157486 Build timestamp as int: 1495157486 my TensorFlow version : 1.0.1
Encontré la solución en el sentido de que quizás parece haber algún error de compatibilidad en la versión 1.6 o superior de tensorflow.
La degradación del tensorflow a la versión 1.5 solucionó mi problema.
Para hacer esto, recomiendo desinstalar la versión 1.8 de tensorflow usando la pip uninstall tensorflow
y nuevamente instalando la versión 1.5 usando la pip install tensorflow==1.5
.
Además, recomendaría que también desinstale y vuelva a instalar la biblioteca keras.
Es posiblemente debido a problemas de compatibilidad. Para mi servidor Ubuntu 18, tuve que usar tensorflow == 1.12 y ahora funciona.
Intente bajar de la versión más reciente (1.12, ahora 26 de marzo de 2019) y vea qué versión funciona.
Este script intenta una versión (trytfver.sh):
pip uninstall tensorflow -y pip install --user tensorflow==$1 python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
Pruébalo como sigue:
bash trytfver.sh 1.12 bash trytfver.sh 1.11 bash trytfver.sh 1.10 bash trytfver.sh 1.9 bash trytfver.sh 1.8 bash trytfver.sh ...
Y vea si aparece algún error de ‘símbolo indefinido’, por ejemplo, tengo un error en 1.11.