tensorflow / tensorflow/tensorboard

module 'PIL.Image' has no attribute 'ANTIALIAS'

Open
#6,853 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.2k
Forks
1.7k
Avg merge
4d 22h
Merged PRs (30d)
1

Description

Environment information (required)

Linux:
image

cuda 11.4
pytorch 1.12.1
Python 3.8.18
PIL 10.3.0
tensorboard 2.14.0

I setup the environment by :
$ conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch

Issue description

When using writer.add_figure to add a figure, there is a Error:

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

The original code line in my project is:
writer.add_figure('indicator/CM', fig)
fig is a matplotlib Figure, where a confusion matrix is drawn.

It seems in the process of add_images of add_figure , it is attempted to get the attribute ANTIALIAS of PIL.Image. BUT in the recent update, it was removed! Since version 10.0.0, ANTIALIAS was already removed, but add_figure method still needs it.
image

Reproduce the problem

Add a figure to a writer. The figure draws a confusion matrix.
This should reproduce the problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at writer.add_figure and follow its add_images path to locate the PIL.Image.ANTIALIAS reference. Reproduce the failure with a Matplotlib Figure and the reported Pillow 10.3.0 environment. Done means adding a figure no longer raises this AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.