Giter VIP home page Giter VIP logo

Comments (9)

rm-hull avatar rm-hull commented on July 30, 2024 1

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.

thijstriemstra avatar thijstriemstra commented on July 30, 2024 1

are you able to import pygame using that interpreter? python3 -c "import pygame" shouldn't throw any errors.

from luma.examples.

EDIflyer avatar EDIflyer commented on July 30, 2024 1

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.

rm-hull avatar rm-hull commented on July 30, 2024 1

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.

EDIflyer avatar EDIflyer commented on July 30, 2024 1

OK have done a PR for that - thanks again @rm-hull and @thijstriemstra - greatly appreciate the rapid help! 👍🥳

from luma.examples.

EDIflyer avatar EDIflyer commented on July 30, 2024

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.

EDIflyer avatar EDIflyer commented on July 30, 2024

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.

rm-hull avatar rm-hull commented on July 30, 2024

Did you see the prerequisites here https://luma-emulator.readthedocs.io/en/latest/install.html#system-packages ?

from luma.examples.

EDIflyer avatar EDIflyer commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.