Dear All,
I am new to keras and related modules. I am trying to import the following:
from keras.callbacks import TensorBoard, ModelCheckpoint
I am getting an error like following which seems to me related with tensorflow
Using TensorFlow backend.
Traceback (most recent call last):
File "/Users/sbhakat/anaconda/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/Users/sbhakat/anaconda/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/Users/sbhakat/anaconda/lib/python3.6/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 "/Users/sbhakat/anaconda/lib/python3.6/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/Users/sbhakat/anaconda/lib/python3.6/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: dlopen(/Users/sbhakat/anaconda/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _clock_gettime
Referenced from: /Users/sbhakat/anaconda/lib/python3.6/site-packages/tensorflow/python/../libtensorflow_framework.so (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
in /Users/sbhakat/anaconda/lib/python3.6/site-packages/tensorflow/python/../libtensorflow_framework.so
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/sbhakat/anaconda/lib/python3.6/site-packages/keras/__init__.py", line 3, in <module>
from . import utils
File "/Users/sbhakat/anaconda/lib/python3.6/site-packages/keras/utils/__init__.py", line 6, in <module>
from . import conv_utils
File "/Users/sbhakat/anaconda/lib/python3.6/site-packages/keras/utils/conv_utils.py", line 9, in <module>
from .. import backend as K
File "/Users/sbhakat/anaconda/lib/python3.6/site-packages/keras/backend/__init__.py", line 89, in <module>
from .tensorflow_backend import *
File "/Users/sbhakat/anaconda/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 5, in <module>
import tensorflow as tf
File "/Users/sbhakat/anaconda/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/Users/sbhakat/anaconda/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Users/sbhakat/anaconda/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Users/sbhakat/anaconda/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/Users/sbhakat/anaconda/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/Users/sbhakat/anaconda/lib/python3.6/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 "/Users/sbhakat/anaconda/lib/python3.6/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/Users/sbhakat/anaconda/lib/python3.6/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: dlopen(/Users/sbhakat/anaconda/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _clock_gettime
Referenced from: /Users/sbhakat/anaconda/lib/python3.6/site-packages/tensorflow/python/../libtensorflow_framework.so (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
in /Users/sbhakat/anaconda/lib/python3.6/site-packages/tensorflow/python/../libtensorflow_framework.so
Failed to load the native TensorFlow runtime.
I checked the installation of tensorflow as I can call tensorflow like following
import tensorflow as tf
I am not sure what is this error and how to solve it. Any help will be highly appreciated.
@omalleyt12 - Just to confirm, is this issue to be opened in Tensorflow repo ?
Hi think the above error maybe due to improper installation of Kreas in my Mac. However in my Linux I installed Keras and Tensorflow properly and got an error like
/home/sbhakat/miniconda2/envs/py36/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.
Traceback (most recent call last):
File "script.py", line 1, in <module>
from keras.callbacks import TensorBoard, ModelCheckpoint
File "/home/sbhakat/miniconda2/envs/py36/lib/python3.6/site-packages/keras/__init__.py", line 3, in <module>
from . import utils
File "/home/sbhakat/miniconda2/envs/py36/lib/python3.6/site-packages/keras/utils/__init__.py", line 27, in <module>
from .multi_gpu_utils import multi_gpu_model
File "/home/sbhakat/miniconda2/envs/py36/lib/python3.6/site-packages/keras/utils/multi_gpu_utils.py", line 7, in <module>
from ..layers.merge import concatenate
File "/home/sbhakat/miniconda2/envs/py36/lib/python3.6/site-packages/keras/layers/__init__.py", line 4, in <module>
from ..engine.base_layer import Layer
File "/home/sbhakat/miniconda2/envs/py36/lib/python3.6/site-packages/keras/engine/__init__.py", line 8, in <module>
from .training import Model
File "/home/sbhakat/miniconda2/envs/py36/lib/python3.6/site-packages/keras/engine/training.py", line 21, in <module>
from . import training_arrays
File "/home/sbhakat/miniconda2/envs/py36/lib/python3.6/site-packages/keras/engine/training_arrays.py", line 8, in <module>
from scipy.sparse import issparse
File "/home/sbhakat/miniconda2/envs/py36/lib/python3.6/site-packages/scipy/sparse/__init__.py", line 229, in <module>
from .csr import *
File "/home/sbhakat/miniconda2/envs/py36/lib/python3.6/site-packages/scipy/sparse/csr.py", line 15, in <module>
from ._sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /home/sbhakat/miniconda2/envs/py36/lib/python3.6/site-packages/scipy/sparse/_sparsetools.cpython-36m-x86_64-linux-gnu.so)
With all my Google search it seems like a conda vs pip installation issue which is kind of mentioned here https://github.com/widdowquinn/pyani/issues/96
Now I wonder how to solve this? Any help?
Unable to reproduce the above issues. I would suggest re-creating the virtual environment.
In my testing on linux this works:
pyenv virtualenv 3.6.7 keras-test
pyenv local keras-test
pip install keras tensorflow
echo 'from keras.callbacks import TensorBoard, ModelCheckpoint' > test.py
$ python test.py
Using TensorFlow backend.
Great it is working.
Most helpful comment
Unable to reproduce the above issues. I would suggest re-creating the virtual environment.
In my testing on linux this works: