Kria KV260 + PYNQ : hard time trying to make it work

Hi,

I am having a hard time trying to install and make work PYNQ on Kria KV260. Any help or suggestions will be welcome.
My config:

  • Kira KV260
  • Ubuntu 20.04 LTS (because I was not able to make Ubuntu 22.04 work correctly. Same problem as described in KR260 Desktop Issue
  • PYNQ v1.0 (checkout to branch v1.0 asked by the install script)
  • Software: provided example “2_python_environment.ipynb”

I went through the installation of PYNQ by cloning the GitHub repository and following the instructions, and I am able to start JupyterLab. Problems arise when I try to execute the provided kernel “2_python_environment.ipynt”, in section “Numpy Data Movement”:

import numpy as np
import pynq

def get_pynq_buffer(shape, dtype):
    """ Simple function to call PYNQ's memory allocator with numpy attributes"""
    
    try:
        return pynq.allocate(shape, dtype)
    except RuntimeError:
        print('Load an overlay to allocate memory')
        return

pynq.allocate() does not work. Looking deeper, It seems that the problem comes from the function _get_xrt_version_embedded() of /usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/pl_server/xrt_device.py:

def _get_xrt_version_embedded():
    output = subprocess.run(
        ["xbutil", "--version"], stdout=subprocess.PIPE, universal_newlines=True
    )
    if output.returncode != 0:
        warnings.warn("xbutil failed to run - unable to determine XRT version")
        return (0, 0, 0)
    xrt_version_str = output.stdout.split("\n")[0].split(":")[1].strip()

    return tuple(map(int, xrt_version_str.split(".")))

“xbutil” has no option “–version”. As a quick workaround, I have replaced the code by xrt_version_str = "1.1.0" (this is given by xbutil dump). But back to “2_python_environment.ipynt”, I have a problem with get_pynq_buffer() function in the next section of code:

buffer = get_pynq_buffer(shape=(4,4), dtype=np.uint32)
buffer

This time, It seems that there is a problem with “global_state_file_exists” in /usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/pl_server/embedded_device.py

I am wandering if I have missed something during the installation or made some mistakes.
Has anyone successfully run PYNQ / Ubuntu on Kria (which version of PYNQ/Ubuntu please)?

Thanks

I failed this example as well but on a different board with a different image.

Hi @JPR75,

Many thanks for reporting this.

For the global_state_file issue, would you mind running cell 1 of kv260/microblaze_c_libraries.ipynb

image

This will download the base overlay and should create the global_state_file if it does not exist already. Then can you try rerunning 2_python_environment.ipynb and report back?

Thanks for flagging the change in the options for xbutil. I’ll try and look into that at some point today.

Many thanks,
Shane

Thank you for your help.

I had to add the ignore_version=True option, because my xilinx.com:ip:axi_iic is 2.1 instead of 2.0:

from kv260 import BaseOverlay

base = BaseOverlay('base.bit', ignore_version=True)

and that solved the problem. I am now able to run the “Numpy Data Movement” section of 2_python_environment.ipynb.

Thanks