PYNQ: PYTHON PRODUCTIVITY

No Module called "pynq"

I have build an image for TE0802 Ultrascale board using the aarch64 rootfs file and the bsp for this board and executed the command below at the PYNQ/sdbuild directory.
bash scripts/image_from_prebuilt.sh TE0802 xilinx-te0802-2020.1.bsp aarch64 focal.aarch64.2.7.0_2021_11_17.tar.gz

It successfully generated the TE0802-2.7.0.img in its output folder.

I then use win32diskimager, and write the TE0802-2.7.0.img successfully. Inserted the SD card and boot up TE0802.

However when I try to run an inference from my Host PC via RPC ssh, it says the target device has no module called “Pynq”.

On the TE0802, I ran $python -m site

1 Like

Hi there,

What exactly are you running to cause the “the target device has no module called “Pynq””? And are you running that from inside the pynq virtualenv? Could you try running these commands as root, first sourcing the virtualenv with source /etc/profile.d/pynq_venv.sh

Thanks
Shawn

1 Like

Hello,

Thank you for your reply,

I am currently running inference of ONNX model via RPC to FPGA, which requires pynq driver to port the model. I used the Pynq image downloaded online for Z1 and the inference went okay, but Z1 has some limited resources so I am now using of TE0802. As earlier explained I have the .img created which was burned into as SD card.

For your advice, I have cleaned and make a new environment, change to root (sudo su) and sourced the virtualenv with source /etc/profile.d/pynq_venv.sh which now append the pynq-venv. However, I still have the same error on the host side RPC Error of target device ‘No module named pynq’

Screenshot from 2022-01-10 16-57-38

So, if I am understanding correctly, you are running an application on your host, and sending commands with rtc over ssh to an application running on your target? Are you able to import pynq on the target over a regular ssh session (without rtc)?

A bit more info on the application and commands you are running would be useful.

Hi,

On a regular ssh session, import pynq on the target FPGA returns, see image below

I am working on Apache TVM environment to run a model on TE0802 Ultrascale via cross-compilation. (RPC). I ran same module on PYNQ-Z1 and no such error, I tried using the image created for TE0802, then I meet the error I earlier complained.

Ok… Good to know that at least pynq works in a regular session. It is a bit strange that your application would run on a Z1 and not on your board, because there shouldn’t be any filesystem changes. Have you installed your target application the same way on both boards?

It seems like for some reason it doesn’t pick up the right python path on the TE0802. Do you by any chance launch your rpc server with sudo, as in sudo start_rpc_server.sh? If you do this and you sourced the virtual environment as a regular user beforehand it will run it as root without the paths for correctly importing pynq. In that case you should probably login as root first, then source the virtual env, then launch your server without sudo.

Thank you once again.

I login as root first, then source the virtual env, then launch my server without sudo, still same result.

Here’s my flow

  1. On host PC
    ssh xilinx@192.168.2.99 (it appears as xilinx@pynq$)

  2. Make root
    Sudo su (it appears as root@pynq$)

  3. Source Virtual Environment (it appears as (pynq-venv)root@pynq$

  4. I start the server without sudo

I noticed the python path and pynq path for Z1 image is totally different from that of the image created for TE0802, ofcourse this is aarch64-linus while the former is arm-linux

Could this have any thing in connection?

Also, I want to try version 2.6 any idea on how to get PYNQ rootfs aarch64 v2.6, so I create an img file for TE0802, I only saw rootfs aarch64 v2.6 on the pynq site

Link:
https://bit.ly/pynq_rootfs_aarch64_v2_6

Cathal

Hello Cathal,

Thank you, however this is an image file (.img), I am looking for this file as a tar(tar.gz) as a prerequisite for prebuilt images creation of custom board

e.g: focal.aarch64.2.6.0_2020_10_19.tar.gz

that will enable me run this command:
bash scripts/image_from_prebuilt.sh TE0802 xilinx-te0802-2020.1.bsp aarch64 focal.aarch64.2.6.0_2020_10_19.tar.gz

Or is there any other way to generate the required img files for my custom board using bionic.aarch64.2.6.0_2020_10_19.img? N/B: I already have the image.ub, BOOT.BIN and boot.scr for my custom board.

Thank you in anticipation

The way prebuilt images are formatted has been changed starting in pynq v2.7, previous pynq versions were using .img format. The sdbuild makefile still accepts both .img and .tar.gz as far as I’m aware, if not you could switch the the v2.6 branch of pynq.

Thanks
Shawn

I downloaded the v2.6 branch as zip as I dont have an idea how to clone this branch.

When I began to build I have this error:
WARNING: /home/eamicheal/PYNQ/sdbuild/boot/meta-pynq/recipes-filesystem/python/python3-pynq_2.3.bb: Exception during build_dependencies for AUTOREV
WARNING: /home/eamicheal/PYNQ/sdbuild/boot/meta-pynq/recipes-filesystem/python/python3-pynq_2.3.bb: Error during finalise of /home/eamicheal/PYNQ/sdbuild/boot/meta-pynq/recipes-filesystem/python/python3-pynq_2.3.bb
ERROR: ExpansionError during parsing /home/eamicheal/PYNQ/sdbuild/boot/meta-pynq/recipes-filesystem/python/python3-pynq_2.3.bb

>        raise FetchError(error_message)

fatal: ‘/home/eamicheal/PYNQ/sdbuild/boot/meta-pynq/recipes-filesystem/python/…/…/…/…/…/’ does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Summary: There were 3 WARNING messages shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
ERROR: Failed to build device-tree
make: *** [Makefile:338: /home/eamicheal/PYNQ/sdbuild/build/TE0802/petalinux_project/images/linux/system.dtb] Error 255
Make failed

After cloning the main github repo git clone https://www.github.com/XILINX/PYNQ you can switch to a different branch with git checkout image_v2.6.0 from inside the repo.

Okay let me try that because the current repo of v2.7 is giving this error about the image file

mkdir -p /home/eamicheal/PYNQ/sdbuild/ccache
sudo rm -fr /home/eamicheal/PYNQ/sdbuild/build/bionic.TE0802
mkdir /home/eamicheal/PYNQ/sdbuild/build/bionic.TE0802
(cd /home/eamicheal/PYNQ/sdbuild/build/bionic.TE0802 && sudo tar -xf /home/eamicheal/PYNQ/sdbuild/bionic.aarch64.2.6.0_2020_10_19.img)
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors
make: *** [Makefile:345: /home/eamicheal/PYNQ/sdbuild/build/TE0802.tar.gz] Error 2

Let me try using the v2.6.0 and hope it works

As an update,

I generated a BSP file (xilinx-zcu104-v2020.1-final.bsp) for TE0802 using the petalinux workflow and also downloaded the board agnostic image file (focal.aarch64.2.6.0_2020_10_19.tar.gz), then copied both into the sdbuild folder.

Thereafter I ran this command:
bash scripts/image_from_prebuilt.sh ZCU104 xilinx-zcu104-v2020.1-final.bsp aarch64 bionic.aarch64.2.6.0_2020_10_19.img

I got the v2.6.0 image file for TE0802.

I ran the inference again and this time I successfully deployed a base and simple model and the error ‘No Module called “PYNQ” no longer appears’, Although, when I run some other complex model it get stuck toward the end after writing the bitstream, I am still looking at what could be responsible for this.

I think the initial error “no module called “Pynq” was as a result of the pynq virtual directory of the v2.7.0, which appears at the /usr/local/share/pynq-venv/lib, but that of v2.6.0 appears at the /usr/lib which the DL Compiler stack and rpc environment setup I am using is compatible with or defined to look out for.

Thanks for the support