Comments (9)
The luma.emulator package provides the capture driver.
At runtime, the core enumerates which display drivers are present and dynamically constructs that list. The docs (and/or cli help) probably ought to be updated to make that clear
from luma.examples.
are you able to import pygame using that interpreter? python3 -c "import pygame"
shouldn't throw any errors.
from luma.examples.
OK so I uninstalled pygame and luma.emulator and reinstalled them again, this time I got a different error...
$python3 demo.py --display capture
pygame 2.1.2 (SDL 2.0.14, Python 3.9.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "/home/pi/demo.py", line 99, in <module>
main()
File "/home/pi/demo.py", line 54, in main
device = get_device()
File "/home/pi/demo_opts.py", line 61, in get_device
device = cmdline.create_device(args)
File "/usr/local/lib/python3.9/dist-packages/luma/core/cmdline.py", line 272, in create_device
device = Device(**vars(args))
File "/usr/local/lib/python3.9/dist-packages/luma/emulator/device.py", line 102, in __init__
super(capture, self).__init__(width, height, rotate, mode, transform, scale)
File "/usr/local/lib/python3.9/dist-packages/luma/emulator/device.py", line 49, in __init__
self._transform = getattr(transformer(pygame, width, height, scale),
File "/usr/local/lib/python3.9/dist-packages/luma/emulator/render.py", line 22, in __init__
[self._pygame.image.load(str(base_dir.joinpath("images", img)))
File "/usr/local/lib/python3.9/dist-packages/luma/emulator/render.py", line 22, in <listcomp>
[self._pygame.image.load(str(base_dir.joinpath("images", img)))
pygame.error: File is not a Windows BMP file
After a bit more Googling I came across this from last year - pygame/pygame#2503
I did sudo apt-get install libsdl2-image-2.0-0
and that seemed to do the trick! So I wonder if the pre-requisites need to be change from libsdl-image1.2-dev
to libsdl2-image-2.0-0
?
(I'm using Raspberry Pi OS bullseye in case that makes any difference)
Anyway, thanks to your both for your help (not to mention creating this excellent library in the first place!) - I've now got PNGs generating so can enhance my user guide!
from luma.examples.
So I wonder if the pre-requisites need to be change from libsdl-image1.2-dev to libsdl2-image-2.0-0?
quite probably
from luma.examples.
OK have done a PR for that - thanks again @rm-hull and @thijstriemstra - greatly appreciate the rapid help! 👍🥳
from luma.examples.
Ahhh! Thanks @rm-hull - I must have twigged that eventually last time I did it then forgot this time! Will submit a PR re the docs.
I installed the emulator which seemed to go OK:
$ sudo -H pip3 install --upgrade luma.emulator
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting luma.emulator
Downloading https://www.piwheels.org/simple/luma-emulator/luma.emulator-1.4.0-py2.py3-none-any.whl (27 kB)
Requirement already satisfied: luma.core>=1.14.0 in /usr/local/lib/python3.9/dist-packages (from luma.emulator) (2.3.1)
Collecting pygame
Downloading https://www.piwheels.org/simple/pygame/pygame-2.1.2-cp39-cp39-linux_armv6l.whl (8.9 MB)
|████████████████████████████████| 8.9 MB 75 kB/s
Requirement already satisfied: pyftdi in /usr/local/lib/python3.9/dist-packages (from luma.core>=1.14.0->luma.emulator) (0.53.3)
Requirement already satisfied: RPI.GPIO in /usr/local/lib/python3.9/dist-packages (from luma.core>=1.14.0->luma.emulator) (0.7.1a4)
Requirement already satisfied: deprecated in /usr/local/lib/python3.9/dist-packages (from luma.core>=1.14.0->luma.emulator) (1.2.13)
Requirement already satisfied: smbus2 in /usr/local/lib/python3.9/dist-packages (from luma.core>=1.14.0->luma.emulator) (0.4.1)
Requirement already satisfied: spidev in /usr/local/lib/python3.9/dist-packages (from luma.core>=1.14.0->luma.emulator) (3.5)
Requirement already satisfied: pillow>=4.0.0 in /usr/local/lib/python3.9/dist-packages (from luma.core>=1.14.0->luma.emulator) (8.4.0)
Requirement already satisfied: cbor2 in /usr/local/lib/python3.9/dist-packages (from luma.core>=1.14.0->luma.emulator) (5.4.2)
Requirement already satisfied: wrapt<2,>=1.10 in /usr/local/lib/python3.9/dist-packages (from deprecated->luma.core>=1.14.0->luma.emulator) (1.13.3)
Requirement already satisfied: pyusb!=1.2.0,>=1.0.0 in /usr/local/lib/python3.9/dist-packages (from pyftdi->luma.core>=1.14.0->luma.emulator) (1.2.1)
Requirement already satisfied: pyserial>=3.0 in /usr/local/lib/python3.9/dist-packages (from pyftdi->luma.core>=1.14.0->luma.emulator) (3.5)
Installing collected packages: pygame, luma.emulator
Successfully installed luma.emulator-1.4.0 pygame-2.1.2
$ python3 -m pip show luma.emulator
Name: luma.emulator
Version: 1.4.0
Summary: A suite of pseudo-devices for luma.core components
Home-page: https://github.com/rm-hull/luma.emulator
Author: Richard Hull
Author-email: [email protected]
License: MIT
Location: /usr/local/lib/python3.9/dist-packages
Requires: luma.core, pygame
Required-by:
But then when I tried to run it I was still getting a complaint about pygame not being installed?
$ ./demo.py --display capture
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/luma/emulator/device.py", line 43, in __init__
import pygame
File "/usr/local/lib/python3.9/dist-packages/pygame/__init__.py", line 83, in <module>
from pygame.base import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
ImportError: libSDL2-2.0.so.0: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/./demo.py", line 99, in <module>
main()
File "/home/pi/./demo.py", line 54, in main
device = get_device()
File "/home/pi/demo_opts.py", line 61, in get_device
device = cmdline.create_device(args)
File "/usr/local/lib/python3.9/dist-packages/luma/core/cmdline.py", line 272, in create_device
device = Device(**vars(args))
File "/usr/local/lib/python3.9/dist-packages/luma/emulator/device.py", line 102, in __init__
super(capture, self).__init__(width, height, rotate, mode, transform, scale)
File "/usr/local/lib/python3.9/dist-packages/luma/emulator/device.py", line 45, in __init__
raise RuntimeError("Emulator requires pygame to be installed")
RuntimeError: Emulator requires pygame to be installed
So I re-ran pygame install separately (although it looks like it was correctly installed before and this just downloaded 2.1.1 in addition to 2.1.2 for some reason??)...
$ sudo -H pip3 install --upgrade pygame
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pygame in /usr/local/lib/python3.9/dist-packages (2.1.2)
Collecting pygame
Using cached https://www.piwheels.org/simple/pygame/pygame-2.1.2-cp39-cp39-linux_armv6l.whl (8.9 MB)
Downloading https://www.piwheels.org/simple/pygame/pygame-2.1.1-cp39-cp39-linux_armv6l.whl (8.9 MB)
|████████████████████████████████| 8.9 MB 52 kB/s
$ python3 -m pip show pygame
Name: pygame
Version: 2.1.2
Summary: Python Game Development
Home-page: https://www.pygame.org
Author: A community project.
Author-email: [email protected]
License: LGPL
Location: /usr/local/lib/python3.9/dist-packages
Requires:
Required-by: luma.emulator
but I still get the same error of the Emulator requiring pygame to be installed?
PS the dynamically generated list from ./demo.py --help
now lists it at least...
--display DISPLAY, -d DISPLAY
Display type, supports real devices or emulators. Allowed values are:
ssd1306, ssd1309, ssd1322, ssd1362, ssd1322_nhd, ssd1325, ssd1327,
ssd1331, ssd1351, sh1106, ws0010, winstar_weh, capture, gifanim, pygame,
asciiart, asciiblock, linux_framebuffer (default: ssd1306)
from luma.examples.
Ahh, interesting @thijstriemstra it does indeed throw an error!...
$ python3 -c "import pygame"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.9/dist-packages/pygame/__init__.py", line 83, in <module>
from pygame.base import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
ImportError: libSDL2-2.0.so.0: cannot open shared object file: No such file or directory
I tried running sudo -H pip3 install --upgrade --force-reinstall --ignore-installed pygame
but still got the same error after when I tried to import it.
Any thoughts how to resolve? 😬
from luma.examples.
Did you see the prerequisites here https://luma-emulator.readthedocs.io/en/latest/install.html#system-packages ?
from luma.examples.
Yes - as far as I could see they were all met? It said 'Requirements already satisfied' for them all? #152 (comment)
from luma.examples.
Related Issues (20)
- OLED SSD1306 HOT 3
- Can't get these to display correctly - max7129 (x4) HOT 4
- Weather.py not working HOT 1
- ST7735 goes black
- Only some Font Awesome icons seems to work? HOT 1
- How to Easily Present Strings Onto 1.12" Mono OLED (128x128, white/black) Breakout – SPI HOT 3
- ModuleNotFoundError: No module named 'luma' - when using Python 3.9.6 HOT 2
- pygame WARNING, No "Setup" File Exists, Running "buildconfig/config.py" HOT 6
- Error running: sudo -H pip install -e . HOT 1
- Default display driver HOT 3
- Tweepy code HOT 5
- Fix deprecated Pillow Commands HOT 3
- Example IP, Temp, Memory, Disk HOT 3
- Displaying both static and scrolling text HOT 2
- Luma error on orange pi zero 2 HOT 3
- Static noise on oled I2C SH1106 display HOT 5
- Module(s) not found because of wrong installation HOT 3
- ERROR: Could not build wheels for pillow which use PEP 517 and cannot be installed directly HOT 2
- Pi Zero 2 W, cannot open resource HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from luma.examples.