Search code examples
pythonpygameraspberry-piyocto

How to add/install pygame to Yocto project on Raspberry Pi 4?


How can you install pygame to your yocto project? Can only seem to find old solutions that doesn't seem to work. I mange to install python3 without any issues, but the meta-python layer doesn't contain pygame as standard. How can you create your own layer/recipe to get pygame?

Tried to create my own recipe from the script here but when I use bitbake add-layer <PATH> I get an error saying that: Specified layer directory <PATH> doesn't contain a conf/layer.conf file

SUMMARY = "Python Game Development"
HOMEPAGE = "https://www.pygame.org"
AUTHOR = "A community project. <[email protected]>"
LICENSE = "LGPL-2.0"
LIC_FILES_CHKSUM = "file://setup.py;md5=59f9a291287e87473bbb98f2c9291c5c"

SRC_URI = "https://files.pythonhosted.org/packages/9a/50/67767e5586a45e7e7b02e6f0e07853f8fcb81b54c66db6278f1a1344491f/pygame-2.1.2.tar.gz"
SRC_URI[md5sum] = "8467a125e9075fa701f082806d228366"
SRC_URI[sha256sum] = "d6d0eca28f886f0477cd0721ac688189155a587f2bb8eae740e52ca56c3ad23c"

S = "${WORKDIR}/pygame-2.1.2"

RDEPENDS_${PN} = ""

inherit setuptools3

How my other files look. local.conf:

MACHINE ??= "raspberrypi4-64"
RASPBERRYPI_DISPLAY = " 1"
IMAGE_INSTALL:append = " python3"
IMAGE_FSTYPES = "wic wic.bmap"

bblayers.conf:

  <PATH>/poky/meta \
  <PATH>/poky/meta-poky \
  <PATH>/poky/meta-yocto-bsp \
  <PATH>/meta-openembedded/meta-oe \
  <PATH>/meta-openembedded/meta-python \
  <PATH>/meta-raspberrypi \

Solution

  • The solution that worked for me: Add meta-python and meta-netoworking via meta-openembedded. In local.conf add IMAGE_INSTALL:append = " python3-pip". While up and running use the command pip3 install pygame