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

Built-images in data module don't work [Windows] #4574

Closed
LaurentRDC opened this issue Apr 10, 2020 · 7 comments
Closed

Built-images in data module don't work [Windows] #4574

LaurentRDC opened this issue Apr 10, 2020 · 7 comments

Comments

@LaurentRDC
Copy link
Contributor

Description

Hello,

I'm trying to load one of the built-in images from the data module, but it appears to fail inexplicably.

Way to reproduce

With a fresh install of scikit-image:

from skimage.data import camera
camera()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Miniconda3\lib\site-packages\skimage\data\__init__.py", line 109, in camera
    return _load("camera.png")
  File "C:\Miniconda3\lib\site-packages\skimage\data\__init__.py", line 96, in _load
    return imread(_os.path.join(data_dir, f), plugin='pil', as_gray=as_gray)
  File "C:\Miniconda3\lib\site-packages\skimage\io\_io.py", line 48, in imread
    img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
  File "C:\Miniconda3\lib\site-packages\skimage\io\manage_plugins.py", line 210, in call_plugin
    return func(*args, **kwargs)
  File "C:\Miniconda3\lib\site-packages\skimage\io\_plugins\pil_plugin.py", line 36, in imread
    return pil_to_ndarray(im, dtype=dtype, img_num=img_num)
  File "C:\Miniconda3\lib\site-packages\skimage\io\_plugins\pil_plugin.py", line 66, in pil_to_ndarray     
    image.seek(i)
  File "C:\Miniconda3\lib\site-packages\PIL\PngImagePlugin.py", line 748, in seek
    self._seek(f)
  File "C:\Miniconda3\lib\site-packages\PIL\PngImagePlugin.py", line 791, in _seek
    cid, pos, length = self.png.read()
AttributeError: 'NoneType' object has no attribute 'read'

For the record, the files (e.g. 'camera.png') are located where I would expect them to be, in the data folder.

Version information

>>> import sys; print(sys.version)
3.7.6 (default, Jan  8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
>>> import platform; print(platform.platform())
Windows-10-10.0.18362-SP0
>>> import skimage; print("scikit-image version: {}".format(skimage.__version__))
scikit-image version: 0.16.2
>>> import numpy; print("numpy version: {}".format(numpy.__version__))
numpy version: 1.18.1
@sciunto
Copy link
Member

sciunto commented Apr 10, 2020

This is due to the recent issues with pillow. Please, downgrade to pillow < 7.1.0.

@sciunto
Copy link
Member

sciunto commented Apr 10, 2020

Also, in the next versions, we will not enforce the use of pillow to read our data #4560

@LaurentRDC
Copy link
Contributor Author

I'm looking at pillow's issues but there doesn't seem to be anything related. Do you know which issue in particular?

@sciunto
Copy link
Member

sciunto commented Apr 10, 2020

You can check, but I guess that it's due to python-pillow/Pillow#4509 Your issue will be solved if you downgrade (I tested it).

@LaurentRDC
Copy link
Contributor Author

Yes indeed, thank you!

@hugovk
Copy link
Contributor

hugovk commented Apr 26, 2020

Pillow 7.1.2 was released yesterday and has a fix for python-pillow/Pillow#4509.

@sciunto
Copy link
Member

sciunto commented Apr 26, 2020

Thanks @hugovk

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

3 participants