Unable to import TorchVision after installation Mac OSX
I've installed Pytorch and Torchvision in the way suggested on their website via pip within a virtual environment (env), and whilst no errors occur during installation when I go to import torchvision in my python code the following error occurs. 



Traceback (most recent call last):
  File "demo.py", line 2, in &lt;module&gt;
    import torchvision
  File "/Users/QuinceyBee/env/lib/python3.7/site-packages/torchvision/__init__.py", line 2, in &lt;module&gt;
    from torchvision import datasets
  File "/Users/QuinceyBee/env/lib/python3.7/site-packages/torchvision/datasets/__init__.py", line 9, in &lt;module&gt;
    from .fakedata import FakeData
  File "/Users/QuinceyBee/env/lib/python3.7/site-packages/torchvision/datasets/fakedata.py", line 3, in &lt;module&gt;
    from .. import transforms
  File "/Users/QuinceyBee/env/lib/python3.7/site-packages/torchvision/transforms/__init__.py", line 1, in &lt;module&gt;
    from .transforms import *
  File "/Users/QuinceyBee/env/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 17, in &lt;module&gt;
    from . import functional as F
  File "/Users/QuinceyBee/env/lib/python3.7/site-packages/torchvision/transforms/functional.py", line 5, in &lt;module&gt;
    from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION
ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' (/Users/QuinceyBee/env/lib/python3.7/site-packages/PIL/__init__.py)



I have tried creating new virtual environments to rebuild from scratch, tried to install via conda within a conda environment, however, neither of these resolved this issue.

I apologise for any format issues, this is the first time posting on here and also I'm relatively new to using python.

Any assistance would be greatly appreciated.

Pillow 7.0.0 removed PILLOW_VERSION, you should use version in your own code instead.


https://pillow.readthedocs.io/en/stable/deprecations.html#pillow-version-constant


If using Torchvision, there is a release planned this week (week 2, 2020) to fix it:


https://github.com/pytorch/vision/issues/1712#issuecomment-570286349


The options are:


wait for the new torchvision release
use the master version of torchvision as given below

pip install -U git+https://github.com/pytorch/vision)

install torchvision from a nightly, which also requires a pytorch from a nightly version
or install Pillow&lt;7 

pip install "pillow&lt;7"


