AttributeError: module 'PIL.Image' has no attribute 'VERSION' python2 pip
By John Parsons •
When trying to run cinnamon-settings python2 I see the following error:
hutber@hutber:~$ cinnamon-settings python2
Traceback (most recent call last): File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 619, in <module> window = MainWindow() File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 247, in __init__ for module in modules: File "/usr/share/cinnamon/cinnamon-settings/modules/cs_backgrounds.py", line 5, in <module> import imtools File "/usr/share/cinnamon/cinnamon-settings/bin/imtools.py", line 623, in <module> if Image.VERSION == '1.1.7':
AttributeError: module 'PIL.Image' has no attribute 'VERSION'I saw this error after installing pip3 install streamdeck_ui --user install
2 Answers
This is a known versioning issue between cinnamon and pillow >= 6.0.0. You can find more info here. As a previous commenter said, you can find the error in /usr/share/cinnamon/cinnamon-settings/bin/imtools.py. However, changing Image.VERSION to PIL.VERSION will not fix the issue for pillow >= 7.0.0. You must instead change the line to if Image.__version__ == '1.1.7':.
If you are comfortable with python. You can modify /usr/share/cinnamon/cinnamon-settings/bin/imtools.py.
- Make a backup of the file. i.e
sudo cp /usr/share/cinnamon/cinnamon-settings/bin/imtools.py /usr/share/cinnamon/cinnamon-settings/bin/imtools.py.bk- Open
/usr/share/cinnamon/cinnamon-settings/bin/imtools.pywith nano
sudo nano /usr/share/cinnamon/cinnamon-settings/bin/imtools.py- Delete line 623 to 636. And shift lines 637 to 645 4 spaces to the left.
Before:
if Image.VERSION == '1.1.7': def split(image): """Work around for bug in Pil 1.1.7 :param image: input image :type image: PIL image object :returns: the different color bands of the image (eg R, G, B) :rtype: tuple """ image.load() return image.split()
else: def split(image): """Work around for bug in Pil 1.1.7 :param image: input image :type image: PIL image object :returns: the different color bands of the image (eg R, G, B) :rtype: tuple """ return image.split()After:
def split(image): """Work around for bug in Pil 1.1.7 :param image: input image :type image: PIL image object :returns: the different color bands of the image (eg R, G, B) :rtype: tuple """ return image.split()A check for version Image.VERSION 1.1.7 is not needed if you are using current version of PIL.
More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"