[CI] ONNX frontend testing is broken due to torchvision/pillow incompatibility

As part of ubuntu_install_onnx.sh we install torchvision==0.4.0, which requires pillow >= 4.1.1 (see here).

As a result of backwards incompatible changes released two days ago on pillow 7.0, torchvision is broken at the moment if you run pip install pillow, as we do in a few places (e.g. some Dockerfiles and ubuntu_install_python_package.sh) when creating our Docker images.

When running the frontend tests on a recently created Docker image from our repository, this is the error it shows (same as https://github.com/pytorch/vision/issues/1718):

Running relay ONNX frontend test...
============================= test session starts ==============================
platform linux -- Python 3.6.10, pytest-5.3.2, py-1.8.1, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /workspace
collecting ... collected 0 items / 1 error

==================================== ERRORS ====================================
_________ ERROR collecting tests/python/frontend/onnx/test_forward.py __________
ImportError while importing test module '/workspace/tests/python/frontend/onnx/test_forward.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/python/frontend/onnx/test_forward.py:20: in <module>
    import torchvision
/usr/local/lib/python3.6/dist-packages/torchvision/__init__.py:2: in <module>
    from torchvision import datasets
/usr/local/lib/python3.6/dist-packages/torchvision/datasets/__init__.py:9: in <module>
    from .fakedata import FakeData
/usr/local/lib/python3.6/dist-packages/torchvision/datasets/fakedata.py:3: in <module>
    from .. import transforms
/usr/local/lib/python3.6/dist-packages/torchvision/transforms/__init__.py:1: in <module>
    from .transforms import *
/usr/local/lib/python3.6/dist-packages/torchvision/transforms/transforms.py:17: in <module>
    from . import functional as F
/usr/local/lib/python3.6/dist-packages/torchvision/transforms/functional.py:5: in <module>
    from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION
E   ImportError: cannot import name 'PILLOW_VERSION'

I can see two potential solutions to the problem:

  1. Pinning the Pillow package installations to pillow < 7
  2. Updating torchvision to a version that will be released next week, according to https://github.com/pytorch/vision/issues/1718

The safer approach seems to be pinning the version of pillow to < 7 (for that I can submit a PR soon), so that we actually can run TVM tests, and then investigate the impact of updating torchvision (we currently use 0.4.0, in conjunction with torch 1.2.0) to the version yet to be released next week. For the second step, it probably needs somebody who understands torch and torchvision better then I do, to make that assessment.

I would like to ask what you all think, so that I can raise the relevant issues on GitHub, but thought that it is better to discuss a little bit about it before doing it. Any thoughts?

in principle we should pin all the dependencies, PR is more than welcomed. we can upgrade the pinned version along with the torch vision when we decide to update

I agree that pinning all dependencies is a good idea. For now, I’m pinning pillow<7 version as previously discussed. I found other mentions to pillow in tutorials and documentation, and included that as well.