How to use Kria-PYNQ from the command line?

Hi,
I recently installed Kria-PYNQ on my KV260, and it works fine from JupyterLab. But, I sometimes want to use PYNQ applications from the command line. When I was using PYNQ v2.6 on ZCU104, there were no problems in using them either from Jupyter or from the command line. However, I get the following error when Kria-PYNQ (or maybe PYNQ v2.7) is usrd from the command line.

ubuntu@kria:~$ sudo python3 
[sudo] password for ubuntu: 
Python 3.8.10 (default, Nov 26 2021, 20:14:08) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/usr/local/share/pynq-venv/lib/python3.8/site-packages')
>>> from pynq import Overlay
>>> ol = Overlay('project_1.bit')
/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/pl_server/device.py:79: UserWarning: No devices found, is the XRT environment sourced?
  warnings.warn(
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/overlay.py", line 336, in __init__
    super().__init__(bitfile_name, dtbo, partial=False, device=device)
  File "/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/bitstream.py", line 111, in __init__
    device = Device.active_device
  File "/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/pl_server/device.py", line 94, in active_device
    raise RuntimeError("No Devices Found")
RuntimeError: No Devices Found
>>> 

Is any additional installation for the XRT environment or anything needed? Please let me know any workaround for this problem.

Thanks.
Tomo.

2 Likes

Hi there,

This is probably because from v2.7 we are running inside a virtual environment.

Instead of running python in sudo try:

sudo -i
source /etc/profile.d/pynq_venv.sh
python3

Thanks
Shawn

3 Likes

Hi Shawn,

Thanks a lot for your prompt and useful reply! Yes, your suggestion works perfectly.

Thanks again.
Tomo.

2 Likes

Hi Shawn,

Thanks, this solved my problem too.

Best Regards,
Giovanni

1 Like