Skip to content

Pytorch example not working with newly released Pillow10.4.0 and default numpy 1.20.1 for RPM distros #102

@jinengandhi-intel

Description

@jinengandhi-intel

On July 1st a new version of Pillow 10.4.0 (https://pypi.org/project/pillow/) was released which is pulled automatically by all RPM based distros like CentOS/RHEL/Rocky Linux/Alma Linux resulting in a failure in the local CI nightly:

python3 download-pretrained-model.py
Traceback (most recent call last):
  File "/home/intel/jenkins/workspace/local_ci_graphene_native_rhel9_server_6.7/gramine/CI-Examples/pytorch/download-pretrained-model.py", line 3, in <module>
    from torchvision import models
  File "/usr/local/lib64/python3.9/site-packages/torchvision/__init__.py", line 6, in <module>
    from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils
  File "/usr/local/lib64/python3.9/site-packages/torchvision/datasets/__init__.py", line 1, in <module>
    from ._optical_flow import FlyingChairs, FlyingThings3D, HD1K, KittiFlow, Sintel
  File "/usr/local/lib64/python3.9/site-packages/torchvision/datasets/_optical_flow.py", line 10, in <module>
    from PIL import Image
  File "/usr/local/lib64/python3.9/site-packages/PIL/Image.py", line 68, in <module>
    from ._typing import StrOrBytesPath, TypeGuard
  File "/usr/local/lib64/python3.9/site-packages/PIL/_typing.py", line 10, in <module>
    NumpyArray = npt.NDArray[Any]
AttributeError: module 'numpy.typing' has no attribute 'NDArray'

After some more debugging we found out that the numpy version that is pulled by default is 1.20.1 and the combination of this version with the new Pillow version is what is causing the error.

When we upgrade numpy to any version >1.21.5 things again work fine and we don't see any error.

Debian based distros are still tagged to older versions of Pillow and hence no regressions are seen for those distros.

Current README for pytorch has steps which have been tested for 18.04 which is very old. Should we update that and as part of list the versions of different components?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions