Import pynq package on non-pynq image

I’m running a non-Pynq image (xilinx 2019.1 kernel with Ubuntu rootfs for the ZCU111), and I’m trying to install the pynq python package (e.g. import pynq in python3) to leverage the xrfdc drivers that “pynq” provides. With that, I started at the Xilinx/PYNQ git page and tried to start installing via:

[1] sudo pip3 install --upgrade git+

I’ve encountered errors along the way and resolved them by installing many dependencies, packages, etc. But, now I’m at an error (not able to find libxlnk_cma.h) when trying to install as shown in [1]. The error appears to be referencing a library I don’t have.

While I continue looking into this library, I’m curious (since I can’t find this answer anywhere else, yet) what are your thoughts on installing the python pynq package on a non-pynq image? I’m digging through Makefiles and cmake files and other files while trying to be efficient with my time, that is it’s taking longer than I thought :smile:

Any thoughts are appreciated. Thanks!

[EDIT/AFTERTHOUGHT]: I guess it seems like, perhaps I’m reinventing the wheel here, so to speak. I say that not being the most familiar with Pynq and all that it allows. My thought was the the pynq package that I can import is only a piece of what a pynq image provides. Meaning, perhaps what I’m doing isn’t much different than what the ZCU111 pynq image provides?

We are retiring that pip install from github. The best thing that you can try, is to install from the sdist.

python3 -m pip install <pynq_sdist>.tar.gz --upgrade --no-deps

where you can download pynq_sdist from

This flow has not been tested on other rootfs so proceed with your own risk.

Thanks! It said it installed, but upon opening python3 and executing import pynq:

>>> import pynq
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/pynq/", line 33, in <module>
    from .pl import PL
  File "/usr/local/lib/python3.6/dist-packages/pynq/", line 39, in <module>
  File "/usr/local/lib/python3.6/dist-packages/pynq/", line 322, in <module>
    class _ClocksUltrascale(_ClocksMeta):
  File "/usr/local/lib/python3.6/dist-packages/pynq/", line 382, in _ClocksUltrascale
  File "/usr/local/lib/python3.6/dist-packages/pynq/", line 115, in __init__
    array = MMIO(address, np.dtype(register_type).itemsize).array
  File "/usr/local/lib/python3.6/dist-packages/pynq/", line 82, in __init__
    device = Device.active_device
  File "/usr/local/lib/python3.6/dist-packages/pynq/pl_server/", line 91, in active_device
    raise RuntimeError("No Devices Found")
RuntimeError: No Devices Found

Devices? *digging into the code … *

Is there a reason you don’t want to use the pre-compiled ZCU111 PYNQ image?

Available here:


I may consider that in the future, but at the moment I’m mostly curious about accessing a bitstream via a python package, and I came across Pynq :slight_smile:

It might be related to the fpga manager. Do you have fpga manager framework enabled on your rootfs? PYNQ users that framework to manage bitstreams.

Yes. I even tried loading the bistream first before importing pynq:

cp <bistream>.bit /lib/firmware
echo 0 > /sys/class/fpga_manager/fpga0/flags
echo <bitstream>.bit > /sys/class/fpga_manager/fpga0/firmware
(shows that it's writing, lasts for about 10-20 seconds)
cat /sys/class/fpga_manager/fpga0/state
(shows operating)

After this, I tried importing pynq and get the same “No devices found” error :confused:

In my device tree, I have:

fpga-full {
                compatible = "fpga-region";
                fpga-mgr = <0x0000000b>;
                #address-cells = <0x00000002>;
                #size-cells = <0x00000002>;

… but nothing else seems related to the fpga_manager.


1 Like

I’m trying to use PYNQ on a Zynqberry device, and I am facing the exact same problem! Did you find a solution for this problem? the Traceback path is exactly the same and fpga_manager is aslo operating!

Unfortunately, no, since I’ve been playing with this in my free time. The variable in my equation that I’m skeptical of is my Ubuntu rootfs. That is, I’m using the Xilinx Linux kernel and an ubuntu rootfs (not the default Petalinux rootfs). Although, I seem to have the right pieces in place. I’m sure I’ll have more free time at some point and will definitely be coming back to this.

The “No devices” is due to a lack of the xlnk device that PYNQ uses for memory allocation on ZYNQ. You need to make sure that CONFIG_XILINX_APF=y is set in the kernel config and the suitable device tree entry is added:

	xlnk {
		compatible = "xlnx,xlnk-1.0";

With that in place you should see /dev/xlnk appear which is what PYNQ searched for on startup.

These config changes will happen automatically if you add the meta-pynq layer to the petalinux project you’re using to build the kernel.


1 Like

Thanks Peter,

thanks for the reply. For my problem (Pynq on zynqberry) I tried your solution but still it does not work and the /dev/xlnk folder is not created. I also read that another configuration is needed:

  • for Zynq-7000 SoC: Device Drivers→ Generic Driver Options → Size in Mega Bytes(256)
  • CONFIG_LOCALVERSION="-xilinx-apf"

Do you have any idea what is going wrong?


That shouldn’t cause the xlnk device not to appear. Would you be able to post /proc/config.gz and the device tree you are using?


Hi Peter,

now I can import pynq successfully. I used the root instead of xilinx and it worked.

Thank you so much.


I anticipate you mean that you changed user to root (sudo su)? If not, can you please clarify your statement, “… used root instead of xilinx.”


yes. Exactly that’s what I did. Also I checked /proc/config.gz to be sure the kernel configuration is set properly.