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

TensorFlow_0.8.0 somehow breaks PIL ? #2101

Closed
liuyifly06 opened this issue Apr 25, 2016 · 3 comments
Closed

TensorFlow_0.8.0 somehow breaks PIL ? #2101

liuyifly06 opened this issue Apr 25, 2016 · 3 comments

Comments

@liuyifly06
Copy link

liuyifly06 commented Apr 25, 2016

Environment info

Operating System:

ubuntu@ip-172-31-32-186:~$ uname -a
Linux ip-172-31-32-186 3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

TensorFlow version and installation method:

ubuntu@ip-172-31-32-186:~$ python -c "import tensorflow; print(tensorflow.__version__)"
0.8.0

I installed with command:
sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl

My problem: Tensorflow break the PIL image read

Steps to reproduce

Following command verifies that my PIL works good without importing TensorFlow:

ubuntu@ip-172-31-32-186:~$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
>>> a = Image.open('bubble-counting/images/original/bubble.jpg')
>>> b = a.getdata()
>>> b[0]
(166, 56, 57)

After importing TensorFlow, same code does not work any more:

ubuntu@ip-172-31-32-186:~$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> from PIL import Image
>>> a = Image.open('bubble-counting/images/original/bubble.jpg')
>>> b = a.getdata()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 1151, in getdata
    self.load()
  File "/usr/local/lib/python2.7/dist-packages/PIL/ImageFile.py", line 235, in load
    raise_ioerror(e)
  File "/usr/local/lib/python2.7/dist-packages/PIL/ImageFile.py", line 59, in raise_ioerror
    raise IOError(message + " when reading image file")
IOError: broken data stream when reading image file

Other info

After uninstall TensorFlow0.8 and install TensorFlow0.7.1, the problem disappeared!

installation code:
sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl

>>> PIL.VERSION
'1.1.7'
>>> pandas.__version__
u'0.18.0'
>>> dask.__version__
'0.8.2'
>>> numpy.__version__
'1.11.0'
>>> scipy.__version__
'0.17.0'

My questions:

  1. Can you reproduce the problem ?
  2. What might be the reason of this problem since I am not familiar with PIL or TensorFlow code ?

If there were any information you need, pls let me know.

@liuyifly06 liuyifly06 changed the title TensorFlow some what broken PIL ? TensorFlow somehow breaks PIL ? Apr 25, 2016
@liuyifly06 liuyifly06 changed the title TensorFlow somehow breaks PIL ? TensorFlow_0.8 somehow breaks PIL ? Apr 25, 2016
@liuyifly06 liuyifly06 changed the title TensorFlow_0.8 somehow breaks PIL ? TensorFlow_0.8.0 somehow breaks PIL ? Apr 25, 2016
@martinwicke
Copy link
Member

Can you try importing tensorflow after PIL? There are some shared library issues we've been seeing where the version of libpng and libjpeg tensorflow is compiled with conflicts with other libraries that are linked against a different version (we've seen problems with OpenCV).

@liuyifly06
Copy link
Author

@martinwicke Import TensorFlow after PIL works. Thanks for the information.

@martinwicke
Copy link
Member

I'm closing this issue as a duplicate of #1924, it seems to be the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants