FS#54606 - [python-tensorflow] "ModuleNotFoundError: No module named 'backports'" when importing tensorflow
Attached to Project:
Community Packages
Opened by Kartik Mohta (kartikmohta) - Tuesday, 27 June 2017, 05:14 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Friday, 30 June 2017, 16:26 GMT
Opened by Kartik Mohta (kartikmohta) - Tuesday, 27 June 2017, 05:14 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Friday, 30 June 2017, 16:26 GMT
|
Details
With python-tensorflow 1.2.0-1 I get the following error:
>>> import tensorflow as tf Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module> from tensorflow.python import * File "/usr/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 63, in <module> from tensorflow.python.framework.framework_lib import * File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/framework_lib.py", line 100, in <module> from tensorflow.python.framework.subscribe import subscribe File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/subscribe.py", line 26, in <module> from tensorflow.python.ops import variables File "/usr/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 26, in <module> from tensorflow.python.ops import control_flow_ops File "/usr/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 70, in <module> from tensorflow.python.ops import tensor_array_ops File "/usr/lib/python3.6/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 33, in <module> from tensorflow.python.util import tf_should_use File "/usr/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py", line 28, in <module> from backports import weakref # pylint: disable=g-bad-import-order ModuleNotFoundError: No module named 'backports' To make it work, need to replace from backports import weakref on line 28 of "/usr/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py" with import weakref |
This task depends upon
https://pypi.python.org/pypi/backports.weakref
https://github.com/tensorflow/tensorflow/pull/11174
You can either take the patch from there or wait for it to be merged.