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
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 5
Private No

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

Closed by  Sven-Hendrik Haase (Svenstaro)
Friday, 30 June 2017, 16:26 GMT
Reason for closing:  Fixed
Comment by Daniel M. Capella (polyzen) - Tuesday, 27 June 2017, 06:12 GMT Comment by Michaël Defferrard (mdeff) - Tuesday, 27 June 2017, 12:42 GMT Comment by Sven-Hendrik Haase (Svenstaro) - Friday, 30 June 2017, 08:24 GMT
Do we have a patch?
Comment by Michaël Defferrard (mdeff) - Friday, 30 June 2017, 14:09 GMT
I just opened a pull request which fixes the issue:
https://github.com/tensorflow/tensorflow/pull/11174

You can either take the patch from there or wait for it to be merged.
Comment by Sven-Hendrik Haase (Svenstaro) - Friday, 30 June 2017, 16:26 GMT
Next release will have this.

Loading...