question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Type of Raspberry Pi

Raspberry Pi Zero WH

Linux Kernel version

Linux raspberrypi 5.10.17+ #1414 Fri Apr 30 13:16:27 BST 2021 armv6l GNU/Linux

Expected behaviour

I’m expecting Python to run the code without errors. I inspected 10s of issues but didn’t find any solution. Before getting that error I was getting something like: No module named luma.led.matrix found or same for luma.core.

Actual behaviour

pi@raspberrypi:~/luma.led_matrix $ sudo python3 -m pip install luma.core luma.led_matrix
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting luma.core
  Using cached https://www.piwheels.org/simple/luma-core/luma.core-2.3.1-py2.py3-none-any.whl (71 kB)
Collecting luma.led_matrix
  Using cached https://www.piwheels.org/simple/luma-led-matrix/luma.led_matrix-1.5.0-py2.py3-none-any.whl (19 kB)
Requirement already satisfied: cbor2 in /usr/local/lib/python3.7/dist-packages (from luma.core) (5.4.2)
Requirement already satisfied: pillow>=4.0.0 in /usr/local/lib/python3.7/dist-packages (from luma.core) (8.4.0)
Requirement already satisfied: spidev in /usr/lib/python3/dist-packages (from luma.core) (3.4)
Requirement already satisfied: RPI.GPIO in /usr/lib/python3/dist-packages (from luma.core) (0.7.0)
Requirement already satisfied: pyftdi in /usr/local/lib/python3.7/dist-packages (from luma.core) (0.53.3)
Requirement already satisfied: smbus2 in /usr/local/lib/python3.7/dist-packages (from luma.core) (0.4.1)
Requirement already satisfied: deprecated in /usr/local/lib/python3.7/dist-packages (from luma.core) (1.2.13)
Installing collected packages: luma.core, luma.led-matrix
Successfully installed luma.core-2.3.1 luma.led-matrix-1.5.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
pi@raspberrypi:~/luma.led_matrix $ sudo python3 examples/matrix_demo.py
Traceback (most recent call last):
  File "examples/matrix_demo.py", line 122, in <module>
    demo(args.cascaded, args.block_orientation, args.rotate, args.reverse_order)
  File "examples/matrix_demo.py", line 22, in demo
    rotate=rotate or 0, blocks_arranged_in_reverse_order=inreverse)
  File "/usr/local/lib/python3.7/dist-packages/luma/led_matrix/device.py", line 89, in __init__
    self.clear()
  File "/usr/local/lib/python3.7/dist-packages/luma/core/mixin.py", line 46, in clear
    self.display(Image.new(self.mode, self.size))
AttributeError: module 'PIL.Image' has no attribute 'new'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
unitythemakercommented, Nov 7, 2021

I found the problem. The integrated was connected incorrectly.

nse-2461396820112576173-83252 nse-9058724158996543697-83253 nse-7768186634596230443-83254

1reaction
thijstriemstracommented, Nov 9, 2021

I found the problem.

nice!

The integrated was connected incorrectly.

Can you be a little more specific? Maybe it helps others googling similar problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python PIL has no attribute 'Image' - Stack Overflow
I'm using python2.6 and got a problem this morning. It said 'module' has no attribute ...
Read more >
Dealing with 'PIL.Image' has no attribute 'register_extensions'
AttributeError : module 'PIL.Image' has no attribute 'register_extensions'. This error occurs if we are using older version of pillow.
Read more >
module 'PIL.Image' has no attribute 'VERSION' python2 pip ...
Probably you got new PIL version which is not backward compatible. Either you uninstall it using pip then cinnamon-settings will use the ...
Read more >
PIL has no attribute: Image : r/learnpython - Reddit
Hey, everyone! I'm trying to execute this notebook , but I came across an attribute error: PIL has no attribute Image.
Read more >
module pil has no attribute image - You.com | The AI Search ...
Given an open('photo', 'rb') as a second argument, it raises an AttributeError "module 'PIL' has no attribute Image". Which means that Python does...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found