<h3 dir="auto">Environment info</h3>
<p dir="auto">Operating System:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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"><pre class="notranslate"><code class="notranslate">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
</code></pre></div>
<p dir="auto">TensorFlow version and installation method:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ubuntu@ip-172-31-32-186:~$ python -c &quot;import tensorflow; print(tensorflow.__version__)&quot;
0.8.0"><pre class="notranslate"><code class="notranslate">ubuntu@ip-172-31-32-186:~$ python -c "import tensorflow; print(tensorflow.__version__)"
0.8.0
</code></pre></div>
<p dir="auto">I installed with command:<br>
<code class="notranslate">sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl</code></p>
<p dir="auto">My problem: Tensorflow break the PIL image read</p>
<h3 dir="auto">Steps to reproduce</h3>
<p dir="auto">Following command verifies that my PIL works good without importing TensorFlow:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; from PIL import Image
&gt;&gt;&gt; a = Image.open('bubble-counting/images/original/bubble.jpg')
&gt;&gt;&gt; b = a.getdata()
&gt;&gt;&gt; b[0]
(166, 56, 57)"><pre class="notranslate"><code class="notranslate">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.
&gt;&gt;&gt; from PIL import Image
&gt;&gt;&gt; a = Image.open('bubble-counting/images/original/bubble.jpg')
&gt;&gt;&gt; b = a.getdata()
&gt;&gt;&gt; b[0]
(166, 56, 57)
</code></pre></div>
<p dir="auto">After importing TensorFlow, same code does not work any more:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; import tensorflow as tf
&gt;&gt;&gt; from PIL import Image
&gt;&gt;&gt; a = Image.open('bubble-counting/images/original/bubble.jpg')
&gt;&gt;&gt; b = a.getdata()
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/local/lib/python2.7/dist-packages/PIL/Image.py&quot;, line 1151, in getdata
    self.load()
  File &quot;/usr/local/lib/python2.7/dist-packages/PIL/ImageFile.py&quot;, line 235, in load
    raise_ioerror(e)
  File &quot;/usr/local/lib/python2.7/dist-packages/PIL/ImageFile.py&quot;, line 59, in raise_ioerror
    raise IOError(message + &quot; when reading image file&quot;)
IOError: broken data stream when reading image file"><pre class="notranslate"><code class="notranslate">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.
&gt;&gt;&gt; import tensorflow as tf
&gt;&gt;&gt; from PIL import Image
&gt;&gt;&gt; a = Image.open('bubble-counting/images/original/bubble.jpg')
&gt;&gt;&gt; b = a.getdata()
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  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
</code></pre></div>
<h3 dir="auto">Other info</h3>
<p dir="auto"><strong>After uninstall TensorFlow0.8 and install TensorFlow0.7.1, the problem disappeared!</strong></p>
<p dir="auto">installation code:<br>
<code class="notranslate">sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; PIL.VERSION
'1.1.7'
&gt;&gt;&gt; pandas.__version__
u'0.18.0'
&gt;&gt;&gt; dask.__version__
'0.8.2'
&gt;&gt;&gt; numpy.__version__
'1.11.0'
&gt;&gt;&gt; scipy.__version__
'0.17.0'"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; PIL.VERSION
'1.1.7'
&gt;&gt;&gt; pandas.__version__
u'0.18.0'
&gt;&gt;&gt; dask.__version__
'0.8.2'
&gt;&gt;&gt; numpy.__version__
'1.11.0'
&gt;&gt;&gt; scipy.__version__
'0.17.0'
</code></pre></div>
<p dir="auto">My questions:</p>
<ol dir="auto">
<li>Can you reproduce the problem ?</li>
<li>What might be the reason of this problem since I am not familiar with PIL or TensorFlow code ?</li>
</ol>
<p dir="auto">If there were any information you need, pls let me know.</p>
<h3 dir="auto">Environment info</h3>
<p dir="auto">Operating System: Ubuntu 14.04.</p>
<p dir="auto">If installed from sources, provide the commit hash: <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/tensorflow/tensorflow/commit/f952246b1756242926d47091d09ceb7c7b963269/hovercard" href="https://github.com/tensorflow/tensorflow/commit/f952246b1756242926d47091d09ceb7c7b963269"><tt>f952246</tt></a></p>
<h3 dir="auto">Steps to reproduce</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ python2 -c &quot;import tensorflow; import cv2; print cv2.imread('cat.jpg')&quot;
None"><pre class="notranslate">$ python2 -c <span class="pl-s"><span class="pl-pds">"</span>import tensorflow; import cv2; print cv2.imread('cat.jpg')<span class="pl-pds">"</span></span>
None</pre></div>
<h3 dir="auto">What have you tried?</h3>
<p dir="auto">import cv2 before tensorflow works.</p>
<p dir="auto">This problem also exists on CentOS 7. It doesn't happen on a latest ArchLinux.<br>
It's likely due to that tensorflow has it's own libjpeg that conflicts with opencv on some platforms.</p>