M BUZZ CRAZE NEWS
// general

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

1

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.

  1. 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
  1. Open /usr/share/cinnamon/cinnamon-settings/bin/imtools.py with nano
sudo nano /usr/share/cinnamon/cinnamon-settings/bin/imtools.py
  1. 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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy