How to build a minimal PYNQ 3.1 image (no Jupyter), only pynq Python library for Overlay(), fitting in 8 GB eMMC

Hi all,

I’m trying to build a minimal PYNQ 3.1 image that includes only the pynq Python library so I can load a bitstream via Overlay(), without Jupyter or panda/numpy stack, and sized to fit an 8 GB eMMC. In the petalinux-config -c rootfs there are no packages selected, just the default ones provided by Trenz in their reference design.

With the standard PYNQ build I get a rootfs of about 6.3 GB; after installing a few extra dependencies it grows further and we run out of space.

What I’ve tried (none succeeded yet):

  1. Remove Stage4 for my board in sdbuild
    Problem: Jupyter, pynq, and the larger Python ecosystem (OpenCV, pandas, etc.) still ended up in the image.
    This might be due to Stage2/Stage3 pulling them in. In \<PYNQ\>/sdbuild/ubuntu/jammy/aarch64 I see:

    STAGE2_PACKAGES_aarch64 := gcc-mb udev libsds python_packages_jammy jupyter
    STAGE2_PACKAGES_aarch64 += sigrok
    STAGE2_PACKAGES_aarch64 += bootpy
    STAGE2_PACKAGES_aarch64 += clear_pl_statefile 
    STAGE3_PACKAGES_aarch64 := xrtlib pynq x11 resizefs
    
  2. “Dirty” approach: remove unused deps from
    \<PYNQ\>/sdbuild/packages/python_packages_jammy/requirements.txt
    Problem: Even after editing, the rootfs was still produced with the full ecosystem (maybe cached or pulled from the repo by Stage2/Stage3 anyway).

  3. Use meta-pynq with PetaLinux (no Stage4, just kernel/DT setup + add pynq myself)
    Problem: Even when pointing to PYNQ 3.1, BitBake tries to fetch python3-pynq_2.3 from PyPI:

    ERROR: python3-pynq-2.3-r0 do_fetch: ... Unable to fetch ... pynq-2.3.tar.gz
    

    It seems the layer provides a python3-pynq_2.3.bb, so BitBake picks 2.3 instead of 3.1.

    I don’t know if this workflow is still valid, I was trying to replicate this steps:
    PYNQ/sdbuild/boot/meta-pynq at master · Xilinx/PYNQ · GitHub

Questions:

  • What’s the recommended way to build a minimal PYNQ 3.1 image (no Jupyter, only pynq so I can do Overlay("*.bit")) that fits in 8 GB eMMC?

Thanks in advance!

Did you check this? PYNQ.remote — Python productivity for Zynq (Pynq)

Thanks for your reply, @marioruiz!

PYNQ.remote is quite interesting; it solves one problem but creates another.

If I understand the PYNQ.remote documentation correctly, we need a host computer to run the application.

Ideally, I would like to run a Python application on the card without needing a host computer.

Do you know if using the meta-pynq layer in Petalinux is a supported workflow?

In my opinion, it seems to be what I’m looking for.

BR,
Carlos.