How to Work Around Xlnk being used in https://github.com/Xilinx/LSTM-PYNQ

Hi, I am trying to use the PYNQ board for Optical Character Recognition (OCR). I found this git repo that does exactly what I am looking for; however, it is a few years old and is still using Xlnk.

So, when I try to clone the github, I get the following error in the terminal:

File "/tmp/pip-req-build-h3_p2379/lstm/lstm.py", line 36, in <module>  
  from pynq import Overlay, PL, Xlnk
ImportError: cannot import name 'Xlnk' from 'pynq' (/usr/local/lib/python3.8/dist-packages/pynq/\_\_init__.py)

Does anyone have any suggestions/tips on how to work around this?

I considered going back to SD image v2.6; however, I am having a difficult time finding the image file. I tried this site; however, when you click PYNQ-Z2 v2.6.0 SDCard image, nothing happens.

Thanks!

Depending on what gets used from Xlnk, some of that has been deprecated and now appears in the pynq library.

https://pynq.readthedocs.io/en/latest/changelog.html

  • Removed Xlnk allocator and libraries for edge devices (replaced by XRT allocation)

It uses:

 def cleanup(self):
        xlnk = Xlnk()
        xlnk.xlnk_reset()

I am unsure how to work around this using allocate. I know that I should use del buffer but I do not know of all the specific buffers I would need to delete.

right. xlnk_reset() resets all the CMA buffers allocated across the system.

Now I think you use “del” but you probably have to call it per-buffer.

So maybe
def cleanup(self):
del buffer_name1
del buffer_name2

as a brute force method