benchmarks icon indicating copy to clipboard operation
benchmarks copied to clipboard

ImportError: cannot import name interleave_ops

Open DjangoPeng opened this issue 7 years ago • 13 comments

After I pull and merge the latest commit, I got the ImportError. I attached the error log as below:

Traceback (most recent call last):
  File "tf_cnn_benchmarks.py", line 26, in <module>
    import benchmark_cnn
  File ".../benchmarks/scripts/tf_cnn_benchmarks/benchmark_cnn.py", line 43, in <module>
    import datasets
  File ".../benchmarks/scripts/tf_cnn_benchmarks/datasets.py", line 28, in <module>
    import preprocessing
  File ".../benchmarks/scripts/tf_cnn_benchmarks/preprocessing.py", line 23, in <module>
    from tensorflow.contrib.data.python.ops import interleave_ops
ImportError: cannot import name interleave_ops

I reviewed the commit and found the latest merged code causing the error. You can find my comment here, and the code here

DjangoPeng avatar Nov 03 '17 08:11 DjangoPeng

It's added to tensorflow only a couple of days ago. You'll need to use latest tensorflow.

ppwwyyxx avatar Nov 03 '17 08:11 ppwwyyxx

@ppwwyyxx Thanks! If so, I think I have to update my TensorFlow version to 1.4 release. My TensorFlow base is 1.4-rc1, whose GitHub hash is 358298.

DjangoPeng avatar Nov 03 '17 08:11 DjangoPeng

Unfortunately updating to tensorflow 1.4 is not enough, I have the same error with TF 1.4

gorogm avatar Nov 03 '17 11:11 gorogm

Commenting that single line //from tensorflow.contrib.data.python.ops import interleave_ops is a quick-fix, if you need only synthetic.

gorogm avatar Nov 03 '17 12:11 gorogm

By "latest tensorflow" I mean something that's built within this week.

ppwwyyxx avatar Nov 03 '17 12:11 ppwwyyxx

TF 1.4 came out 18 hours ago, it would be nice if benchmarks could use that version.

gorogm avatar Nov 03 '17 12:11 gorogm

OK..I should say built with the latest source code from master branch within this week. 1.4 was released with earlier version of the source code plus some cherry picks. You can use pip install tf-nightly-gpu, to get the latest.

ppwwyyxx avatar Nov 03 '17 13:11 ppwwyyxx

This bug is really frustrated. It's still in the latest pip release when using Ubuntu 16 or CentOS 7.

Caused so much damage.

beef9999 avatar Nov 27 '17 10:11 beef9999

@ppwwyyxx Is there a official guide or temporary solution?

DjangoPeng avatar Nov 27 '17 11:11 DjangoPeng

As @ppwwyyxx, you unfortunately need to use the nightly TensorFlow version, which you can get by running

pip install tf-nightly-gpu

Alternatively, you can build from source. Using the latest stable version, which is currently TensorFlow 1.4, will not work.

We develop tf_cnn_benchmarks on the nightly version of TensorFlow, so we can quickly use and benchmark new features of TensorFlow before they are released. But ideally we would have a branch of tf_cnn_benchmarks which works on the latest stable version of TensorFlow. I will try to set that up in the future, perhaps starting with TensorFlow 1.5 when it comes out.

reedwm avatar Nov 27 '17 23:11 reedwm

@reedwm Thanks for your replying! I'd like to build from source on a stable version. Look forward to the stable testing branch of tf_cnn_benchmarks.

DjangoPeng avatar Nov 28 '17 00:11 DjangoPeng

@reedwm I've installed latest TF using

pip install tf-nightly-gpu

as suggested and got:

Successfully installed astor-0.6.2 gast-0.2.0 tb-nightly-1.5.0a20180114 termcolor-1.1.0 tf-nightly-gpu-1.6.0.dev20180114 (tensorflow_p27) ubuntu@ip-172-31-9-87:/mnt/weka/benchmarks/scripts/tf_cnn_benchmarks$ python2 tf_cnn_benchmarks.py --help Traceback (most recent call last): File "tf_cnn_benchmarks.py", line 25, in import tensorflow as tf File "/home/ubuntu/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow/init.py", line 24, in from tensorflow.python import * File "/home/ubuntu/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow/python/init.py", line 49, in from tensorflow.python import pywrap_tensorflow File "/home/ubuntu/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "/home/ubuntu/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "/home/ubuntu/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "/home/ubuntu/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory

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.

bentsi avatar Jan 15 '18 14:01 bentsi

@bentsi make sure you have Cuda 9.0 installed. Tensorflow nightly does not work with earlier versions of Cuda, nor Cuda 9.1.

reedwm avatar Jan 16 '18 18:01 reedwm