Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when opening .npz file with tf.gfile.GFile on Python 3.7 #27276

Closed
Corea opened this issue Mar 29, 2019 · 3 comments · Fixed by #28006 or #27301
Closed

Crash when opening .npz file with tf.gfile.GFile on Python 3.7 #27276

Corea opened this issue Mar 29, 2019 · 3 comments · Fixed by #28006 or #27301
Assignees
Labels
type:others issues not falling in bug, perfromance, support, build and install or feature

Comments

@Corea
Copy link
Contributor

Corea commented Mar 29, 2019

Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Arch Linux
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): binary (pip)
  • TensorFlow version (use command below): v1.13.0-rc2-5-g6612da8 / 1.13.1
  • Python version: Python 3.7
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version: 10.1 / 7.5.0
  • GPU model and memory: GTX 1080 / 8G

You can collect some of this information using our environment capture script
You can also obtain the TensorFlow version with
python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"

Describe the current behavior
A code below works well on Python 3.6 with TF 1.12. On Python 3.7 with TF 1.13, however, the code crashes.

Describe the expected behavior

Do not crash.

Code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate the problem.

import numpy as np
import tensorflow as tf

information = { "a": 1, "b": 2 }
np.savez_compressed("a.npz", **information)

with tf.gfile.Open("a.npz", "rb") as file_:
  info = np.load(file_)

info_dict = { key: info[key] for key in info.items() }  # crash on Python 3.7 with TF 1.13.1

Traceback

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <dictcomp>
  File "/csehome/youhanmir/.virtualenvs/learning-implicit-action/lib/python3.7/_collections_abc.py", line 744, in __iter__
    yield (key, self._mapping[key])
  File "/csehome/youhanmir/.virtualenvs/learning-implicit-action/lib/python3.7/site-packages/numpy/lib/npyio.py", line 251, in __getitem__
    bytes = self.zip.open(key)
  File "/usr/lib64/python3.7/zipfile.py", line 1480, in open
    self._fpclose, self._lock, lambda: self._writing)
  File "/usr/lib64/python3.7/zipfile.py", line 722, in __init__
    self.seekable = file.seekable
AttributeError: 'GFile' object has no attribute 'seekable'

Other info / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

@yongtang
Copy link
Member

Added a PR #27301 for the fix.

@ymodak ymodak self-assigned this Mar 29, 2019
@ymodak ymodak added the type:others issues not falling in bug, perfromance, support, build and install or feature label Mar 29, 2019
@Corea
Copy link
Contributor Author

Corea commented Apr 17, 2019

As I wrote comments on #27301 (comment), this issue should be opened again.
@ymodak, Could you re-open this issue?

@yongtang
Copy link
Member

Reopened and add a follow up PR #28006 to fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:others issues not falling in bug, perfromance, support, build and install or feature
Projects
None yet
3 participants