Hello, I tried to use PYNQ3.0 on the kria kv260 development board and encountered the following problem: I can successfully load the bitstream file using overlay in the jupternotebook debugging page, but when I try to use sysyemb to write a process named fpga_load.service, the following error occurs:
Oct 13 06:22:23 kria systemd[1]: /etc/systemd/system/fpga_load.service:1: Unknown section ‘Uint’. Ignoring.
Oct 13 06:22:23 kria systemd[1]: Starting fpga_load.service…
Oct 13 06:22:28 kria python3[4957]: /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/pl_server/device.py:56: UserWarning: No devices found, is the XRT environment sourced?
Oct 13 06:22:28 kria python3[4957]: warnings.warn(
Oct 13 06:22:28 kria python3[4957]: Traceback (most recent call last):
Oct 13 06:22:28 kria python3[4957]: File “”, line 1, in
Oct 13 06:22:28 kria python3[4957]: File “/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/overlay.py”, line 315, in init
Oct 13 06:22:28 kria python3[4957]: super().init(bitfile_name, dtbo, partial=False, device=device)
Oct 13 06:22:28 kria python3[4957]: File “/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/bitstream.py”, line 88, in init
Oct 13 06:22:28 kria python3[4957]: device = Device.active_device
Oct 13 06:22:28 kria python3[4957]: File “/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/pl_server/device.py”, line 71, in active_device
Oct 13 06:22:28 kria python3[4957]: raise RuntimeError(“No Devices Found”)
Oct 13 06:22:28 kria python3[4957]: RuntimeError: No Devices Found
Oct 13 06:22:29 kria systemd[1]: fpga_load.service: Main process exited, code=exited, status=1/FAILURE
Oct 13 06:22:29 kria systemd[1]: fpga_load.service: Failed with result ‘exit-code’.
Oct 13 06:22:29 kria systemd[1]: Failed to start fpga_load.service.
Oct 13 06:22:29 kria systemd[1]: fpga_load.service: Consumed 5.587s CPU time.
Oct 13 06:26:18 kria systemd[1]: Starting fpga_load.service…
Oct 13 06:26:23 kria python3[5548]: /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/pl_server/device.py:56: UserWarning: No devices found, is the XRT environment sourced?
Oct 13 06:26:23 kria python3[5548]: warnings.warn(
Oct 13 06:26:23 kria python3[5548]: Traceback (most recent call last):
Oct 13 06:26:23 kria python3[5548]: File “”, line 1, in
Oct 13 06:26:23 kria python3[5548]: File “/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/overlay.py”, line 315, in init
Oct 13 06:26:23 kria python3[5548]: super().init(bitfile_name, dtbo, partial=False, device=device)
Oct 13 06:26:23 kria python3[5548]: File “/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/bitstream.py”, line 88, in init
Oct 13 06:26:23 kria python3[5548]: device = Device.active_device
Oct 13 06:26:23 kria python3[5548]: File “/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/pl_server/device.py”, line 71, in active_device
Oct 13 06:26:23 kria python3[5548]: raise RuntimeError(“No Devices Found”)
Oct 13 06:26:23 kria python3[5548]: RuntimeError: No Devices Found
Oct 13 06:26:24 kria systemd[1]: fpga_load.service: Main process exited, code=exited, status=1/FAILURE
Oct 13 06:26:24 kria systemd[1]: fpga_load.service: Failed with result ‘exit-code’.
Oct 13 06:26:24 kria systemd[1]: Failed to start fpga_load.service.
Oct 13 06:26:24 kria systemd[1]: fpga_load.service: Consumed 5.406s CPU time
My fpga_load.service process is in the attached file. fpga_load.service.txt (507 Bytes)
In fpga_load.service.txt, in addition to a uint error, a warning that the device cannot be found appears. I tried to print the configuration information on the jupternotebook page, as shown in Figure 1.png
Xrt should have been successfully installed, but when calling overlay to load the bitstream file outside of jupternotebook, the device cannot be recognized. I checked the xrt installation directory and did not find xrt-info. Is it because this function package is missing during the installation process, or is xrt-info abandoned in the xrt2.13.479-0ubuntu2 version? The inability to recognize the device here is just an environment setting problem.
thank you!
Sorry to bother you again. After I executed source /etc/profile.d/pynq_venv.sh, the previous problem has been solved, but new problems have arisen as follows:
× fpga_load.service - Load FPGA bitstream at startup
Loaded: loaded (/etc/systemd/system/fpga_load.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2024-10-17 11:54:35 UTC; 13s ago
Process: 6821 ExecStart=/usr/bin/python3.10 -c from pynq import Overlay; overlay = Overlay(“/home/ubuntu/xilinx/work/case/mnist_cnn/overlays/mnist_cnn.bit”); print(“Bitstream loaded successfully”) >>>
Main PID: 6821 (code=exited, status=1/FAILURE)
CPU: 524ms
Oct 17 11:54:34 kria systemd[1]: Starting Load FPGA bitstream at startup…
Oct 17 11:54:35 kria python3.10[6821]: Traceback (most recent call last):
Oct 17 11:54:35 kria python3.10[6821]: File “”, line 1, in
Oct 17 11:54:35 kria python3.10[6821]: ModuleNotFoundError: No module named ‘pynq’
Oct 17 11:54:35 kria systemd[1]: fpga_load.service: Main process exited, code=exited, status=1/FAILURE
Oct 17 11:54:35 kria systemd[1]: fpga_load.service: Failed with result ‘exit-code’.
Oct 17 11:54:35 kria systemd[1]: Failed to start Load FPGA bitstream at startup.
I also modified the content of fpga_load.service as follows:
[Unit]
Description=Load FPGA bitstream at startup
After=network.target # 可根据实际需求修改
[Service]
Type=oneshot # 表示服务只运行一次,完成加载后退出
[Service]
Type=oneshot
ExecStart=/usr/bin/python3.10 -c ‘from pynq import Overlay; overlay = Overlay(“/home/ubuntu/xilinx/work/case/mnist_cnn/overlays/mnist_cnn.bit”); print(“Bitstream loaded successfully”)’ >> /var/log/fpga_load.log 2>&1
RemainAfterExit=yes
Change the previously used Python interpreter address pointing to the PYNQ installation directory to the actual Python interpreter address /usr/bin.python3.10. At the same time, I also checked the Python environment version installed on the system and the sys.path corresponding to the Python 3.10 interpreter. The results are as follows:
pynq-venv) ubuntu@kria:/etc/systemd/system$ cd ~
(pynq-venv) ubuntu@kria:~$ python3 -m pip show pynq
Name: pynq
Version: 3.0.1
Summary: (PY)thon productivity for zy(NQ)
Home-page: GitHub - Xilinx/PYNQ: Python Productivity for ZYNQ
Author: Xilinx PYNQ Development Team
Author-email: pynq_support@xilinx.com
License: BSD 3-Clause
Location: /usr/local/share/pynq-venv/lib/python3.10/site-packages
Requires: cffi, nest-asyncio, numpy, pynqmetadata, pynqutils, setuptools
Required-by: kv260, pynq-composable, pynq-dpu, pynq-peripherals
(pynq-venv) ubuntu@kria:~$ python3 --version
Python 3.10.12
(pynq-venv) ubuntu@kria:~$ python3
Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
import sys
print(sys.path)
[‘’, ‘/home/ubuntu/kv260_ros2_node/dev_ws/install/ps_receive_node/lib/python3.10/site-packages’, ‘/home/ubuntu/kv260_ros2_node/dev_ws/install/mnist_cnn_interface/lib/python3.10/site-packages’, ‘/home/ubuntu/xilinx/work/dev_ws/install/forest_mnist_cnn_fpga_node/lib/python3.10/site-packages’, ‘/home/ubuntu/xilinx/work/dev_ws/install/forest_mnist_cnn_interface/lib/python3.10/site-packages’, ‘/opt/ros/humble/lib/python3.10/site-packages’, ‘/opt/ros/humble/local/lib/python3.10/dist-packages’, ‘/usr/local/share/pynq-venv/lib/python3.10/site-packages’, ‘/usr/lib/python310.zip’, ‘/usr/lib/python3.10’, ‘/usr/lib/python3.10/lib-dynload’, ‘/usr/local/lib/python3.10/dist-packages’, ‘/usr/lib/python3/dist-packages’, ‘/usr/lib/python3.10/dist-packages’]
exit()
(pynq-venv) ubuntu@kria:~$
It seems that there shouldn’t be a problem with the PYNQ module not being recognized, but the problem still occurs!
OK, Sorry to bother you again.I want to write a systemb-type fpga_load.service process outside of jupternotebook to load the bitstream file when the system starts.
I implemented the writing of fpga_load.service and ran fpga_load.service in the pynq-venv environment. When running fpga_load.service, the command: ExecStart=/usr/local/share/pynq-venv/bin/python3 -c from pynq import Overlay;
overlay=Overlay(“/home/ubuntu/xilinx/work/case/mnist_cnn/overlays/mnist_cnn.bit”);
print(“Bitstream loaded successfully”);
At first, the XRT environment could not be recognized. I changed /usr/local/share/pynq-venv/bin/python3 to /usr/bin/python3.10. /usr/bin/python3.10 is the interpreter address actually pointed to by the python interpreter in the PYNQ virtual environment. When running, the XRT environment will not be unrecognizable, but the PYNQ module will not be recognized.
Check the Ubuntu python version and whether the PYNQ module path is set correctly in the python interpreter environment. The output shows that the PYNQ module installation path has been set correctly.
Is the failure to recognize the PYNQ module due to a certain environment setting? Can you provide some reference suggestions?
Thank you for your answer again. I tried to refer to your suggestion and added ‘source /etc/profile.d/pynq_venv.sh’ before the ExecStart statement, but the problem still exists. I directly entered the root user mode in the bash shell, checked the address of the python interpreter when the virtual environment was not activated, activated the PYNQ virtual environment, and checked the address of the python interpreter again. The python interpreter was used to load the bitstream file, and the loading was successful. This shows that the error in the operation of load_fpga.service should be a problem with the function content. I will continue to try. Thank you for your answer. I hope I can tell you my success next time.