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.aarch22.214.171.124_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
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
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’
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.
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
On host PC
ssh firstname.lastname@example.org (it appears as xilinx@pynq$)
Sudo su (it appears as root@pynq$)
Source Virtual Environment (it appears as (pynq-venv)root@pynq$
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
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
that will enable me run this command:
bash scripts/image_from_prebuilt.sh TE0802 xilinx-te0802-2020.1.bsp aarch64 focal.aarch126.96.36.199_2020_10_19.tar.gz
Or is there any other way to generate the required img files for my custom board using bionic.aarch188.8.131.52_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.
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
(cd /home/eamicheal/PYNQ/sdbuild/build/bionic.TE0802 && sudo tar -xf /home/eamicheal/PYNQ/sdbuild/bionic.aarch184.108.40.206_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.aarch220.127.116.11_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.aarch18.104.22.168_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
I am re-opening this thread because, I still need the features of v2.7 somewhere in my project.
Its known that I am having issues with this no module called pynq because of the venv path in v2.7 which is different from v2.6.
Apart from sourcing the virtual env on the FPGA, I’m I suppose to define a custom Venv on my host PC to check for a new v-environ?
Any idea would be helpful please
I’m not very well versed in rpc applications, it could be helpful if you shared links to any tutorials or material you’ve been following, to get a better grasp of what is going on.
One solution, because you don’t seem to have trouble running pynq locally, could be to run directly on the device, as discussed on this post. It might be also worthwhile posting on that forum as well and see if you could get any pointers.
This tutorial is what I am following, the part B - Xilinx Pynq FPGA Setup
I tried on v2.6 and works fyn but on v2.7, I have not got it working
For your suggested tread, Ive posted an enquiry since last year and yet to receive a reply, however this looks more of working with venv on v2.7 rtaher than rpc.
Someone suggested - If you are using host (e.g., your desktop) and target (your board). Make sure you install Pynq v2.7 on both platforms, Is it possible to install Pynq v2.7 on my host PC?
You might be able to install pynq on a host PC, but I’m not 100% on that.
See this start_rpc_server.sh file, one thing to try could be to add
source /etc/profile.d/pynq_venv.sh at the end of that script. Or append the python paths you see after sourcing the virtualenv.
I tried this on v2.7
Added these to the start_rpc_server.sh 1. source /etc/profile.d/pynq_venv.sh 2. pythonpath (/usr/local/share/pynq-venv/bin/python)
Then as root, I source for and rpc_server.py
I now have a new errror “ImportError: cannot import name ‘xlnx’ from ‘pynq’”
I look at the rpc_server.py and saw these line throwing the error, but same script they works fyn on v2.6
if env.TARGET == “pynq”:
from pynq import xlnk
xlnk is deprecated in 2.7.0 Release Austin Release · Xilinx/PYNQ · GitHub,
pynq.allocate() is the API you should be using now to allocate buffers.