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

Pillow 5.1 is broken on OS X #516

Closed
Robin-des-Bois opened this issue May 25, 2018 · 8 comments
Closed

Pillow 5.1 is broken on OS X #516

Robin-des-Bois opened this issue May 25, 2018 · 8 comments

Comments

@Robin-des-Bois
Copy link

Robin-des-Bois commented May 25, 2018

When installing torch and torchvision in a clean virtualenv with python3.6 and the corresponding pip on OS X

import torchvision

leads to

torch-venv/lib/python3.6/site-packages/PIL/_imaging.cpython-36m-darwin.so, 2): Symbol not found: _clock_gettime
torch-venv/lib/python3.6/site-packages/PIL/.dylibs/liblzma.5.dylib (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib

This is a known bug see Pillow Issue 3068

As a pytorch user it can be fixed by specifying the Pillow version in your requirements.txt

Pillow!=5.1.0
torch
torchvision

The setup.py should get updated with something like:

install_requires=['Pillow != 5.1.0 ; platform_system = "Darwin"']
@vfdev-5
Copy link
Collaborator

vfdev-5 commented May 25, 2018

@Robin-des-Bois if I understand correctly the problem is with Pillow on OSX, I mean that if you install another version with pip before installing torchvision it should work ?

pip install Pillow!=5.1.0
pip install torchvision

@Robin-des-Bois
Copy link
Author

Robin-des-Bois commented May 25, 2018

Exactly.

As long as the current version of Pillow is broken, it might make sense to make sure that torchvision's setup.py installs another version (on OS X) so that a potential user does not have to experience a crash when importing torchvision.

@vfdev-5
Copy link
Collaborator

vfdev-5 commented May 25, 2018

I see, maybe if maintainers are OK with what you propose as a change in setup.py and if it is working correctly you could send a PR :

install_requires=['Pillow != 5.1.0 ; platform_system = "Darwin"']

however taking a look at the current setup.py:

'pillow >= 4.1.1',

you would need to adapt the condition with the current state

Robin-des-Bois added a commit to Robin-des-Bois/vision that referenced this issue May 26, 2018
@vfdev-5
Copy link
Collaborator

vfdev-5 commented May 26, 2018

@Robin-des-Bois I think the issue with MacOSX is also related to the OSX version. I just tested on OSX 10.13.2 the following :

virtualenv --python=python3.6 venv
source venv/bin/activate
(venv) $ python3 --version
> Python 3.6.4
(venv) $ pip3 install torchvision
(venv) $ python3 -c "import torchvision; print(torchvision.__version__)"
> 0.2.1

So, I can not reproduce the issue.

Following the discussion from Pillow, they are almost done with 5.1.1 release

I'm not very sure that we need to change the master now to temporary fix the problem with (let's say old) OSX version and then after their release remove it. What do you think ?

@Robin-des-Bois
Copy link
Author

sounds reasonable. especially since the fix as a user is so simple...

@fmassa
Copy link
Member

fmassa commented Jun 6, 2018

I'm not sure there is any action that needs to be taken here from our end.
Closing this, but feel free to comment if you disagree.

@fmassa fmassa closed this as completed Jun 6, 2018
@dharmeshkakadia
Copy link

dharmeshkakadia commented Jan 2, 2020

@vfdev-5 I can reproduce with the exact same commands you posted. Is there a suggestion on how to fix it? Happy to provide more debugging info if needed as well.

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/dharmesh/code/pytorch-CycleGAN-and-pix2pix/venv/lib/python3.6/site-packages/torchvision/__init__.py", line 4, in <module>
    from torchvision import datasets
  File "/Users/dharmesh/code/pytorch-CycleGAN-and-pix2pix/venv/lib/python3.6/site-packages/torchvision/datasets/__init__.py", line 9, in <module>
    from .fakedata import FakeData
  File "/Users/dharmesh/code/pytorch-CycleGAN-and-pix2pix/venv/lib/python3.6/site-packages/torchvision/datasets/fakedata.py", line 3, in <module>
    from .. import transforms
  File "/Users/dharmesh/code/pytorch-CycleGAN-and-pix2pix/venv/lib/python3.6/site-packages/torchvision/transforms/__init__.py", line 1, in <module>
    from .transforms import *
  File "/Users/dharmesh/code/pytorch-CycleGAN-and-pix2pix/venv/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 17, in <module>
    from . import functional as F
  File "/Users/dharmesh/code/pytorch-CycleGAN-and-pix2pix/venv/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 5, in <module>
    from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION
ImportError: cannot import name 'PILLOW_VERSION'

@hugovk
Copy link

hugovk commented Jan 3, 2020

@dharmeshkakadia That's a duplicate of #1712:

We will be releasing a new version of PyTorch and torchvision early next week, so this should be soon fixed.

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

No branches or pull requests

5 participants