Running existing code after an update to the newest version of the Pillow package and trying to save the resulting plot as a jpgimage.
savefig('image.jpg') correctly saving an image in the jpg format as usual.
With Pillow version 7.0.0, returned error:
ValueError: Format 'jpg' is not supported (supported formats: eps, pdf, pgf, png, ps, raw, rgba, svg, svgz)
The error is not present and plot is saved correctly after downgrading to version 6.2.2
Fails even with this minimal code:
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(15,10))
fig.savefig('test.jpg')
Thanks for the report.
This is because Pillow 7.0.0 removed PILLOW_VERSION, which the current latest matplotlib==3.1.2 uses to check if Pillow is installed.
This has been fixed in matplotlib in https://github.com/matplotlib/matplotlib/pull/16086, and should be released in the next matplotlib 3.1.x and 3.2.0.
In the meantime, either:
pillow<7https://github.com/matplotlib/matplotlib/pull/16086#issuecomment-575826240 reports that matplotlib 3.1.3 should be released by end of day tomorrow. So after that, you should simply be able to update matplotlib to resolve this.
Thank you @hugovk and @radarhere for your replies. For now I will stick with older version of Pillow as it works well for my current needs and make a move to never matplotlib in the future.
Most helpful comment
https://github.com/matplotlib/matplotlib/pull/16086#issuecomment-575826240 reports that matplotlib 3.1.3 should be released by end of day tomorrow. So after that, you should simply be able to update matplotlib to resolve this.