# After transferring tcl and bitstream to pynq how to use it

**URL:** <https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231>\
**Category:** Support\
**Created:** [June 20, 2019, 7:02am UTC](https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231 "2019-06-20T07:02:12Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ambarish](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@ambarish](https://discuss.pynq.io/u/ambarish)\
**Post date:** [June 20, 2019, 7:02am UTC](https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231/1 "2019-06-20T07:02:12Z")

</div>

I have transferred the pynq lstm tcl and bit files to the pynq repo via network.  
Then i loaded the bit file by the following lines:  
from pynq import Overlay  
overlay=Overlay(‘path to bit file/top\_lstm.bit’)

Then if i run the inference its not able to find the .so files in the library of the pynq repo.  
Even if i copy the .so files to the jupyter notebook , it doesnt get copied.

How to run the inference after transferring the overlay to the pynq folder of the board.  
there must be some way of using this overlay to get the inference. Please help

---

<div class="post-metadata">

**Author:** ![cathalmccabe](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/cathalmccabe/32/3348_2.png) [@cathalmccabe](https://discuss.pynq.io/u/cathalmccabe)\
**Post date:** [June 20, 2019, 7:21am UTC](https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231/2 "2019-06-20T07:21:53Z")

</div>

It would be helpful if you could describe in detail what you did, and post full error messages.

Cathal

---

<div class="post-metadata">

**Author:** ![ambarish](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@ambarish](https://discuss.pynq.io/u/ambarish)\
**Post date:** [June 20, 2019, 7:38am UTC](https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231/3 "2019-06-20T07:38:15Z")

</div>

I am using a zedboard. The pynq/lstm repo is supported for pynq-z1 and z2.  
I have rebuilt the pynq lstm hardware design which created the ip for me along with the bit-stream and the tcl file.  
I transferred the tcl file and bitstream to the pynq directory in my board via network on ubuntu 16.04  
i also copied the pynq lstm directory to the jupyternotebooks folder of the board again via the network.  
The repo on github is having several folders like the lstm, notebooks.  
I created this ipynb file inside the notebooks folder on jupyter.

Then i have written the code shown in the pic with the error messages.  
Please guide as to how should i perform my inference

 ![Screenshot%20from%202019-06-20%2015-35-43](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/1X/4f0298c8e202ee5534b9953970977cc32bd33775.png) ![Screenshot%20from%202019-06-20%2015-36-05](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/1X/24498e6ab9a20da9107c28aca84eab9f62a8ccf9.png)

Inspite of copying the full repo to the jupyter notebook, the .so files present in the library are not getting copied, which might cause the error.

---

<div class="post-metadata">

**Author:** ![ambarish](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@ambarish](https://discuss.pynq.io/u/ambarish)\
**Post date:** [June 20, 2019, 8:40am UTC](https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231/4 "2019-06-20T08:40:31Z")

</div>

Any idea what the error might be?  
ambarish

---

<div class="post-metadata">

**Author:** ![cathalmccabe](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/cathalmccabe/32/3348_2.png) [@cathalmccabe](https://discuss.pynq.io/u/cathalmccabe)\
**Post date:** [June 20, 2019, 8:50am UTC](https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231/5 "2019-06-20T08:50:02Z")

</div>

Looks like you are missing the .so files mentioned in the error message. Do they exist in the locations specified in the error message?

I think the problem is you have just copied the whole repository or directory over. When you use the overlay, it is usually installed using pip (pip3 command) which installs the shared libraries to the board.

Have you tried install it first, and then copying the new bit/tcl to the board?  
Cathal

---

<div class="post-metadata">

**Author:** ![ambarish](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@ambarish](https://discuss.pynq.io/u/ambarish)\
**Post date:** [June 20, 2019, 8:54am UTC](https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231/6 "2019-06-20T08:54:41Z")

</div>

If i try to install the repo to the board , it fails since the setup.py mentions that the board must be either a pynq z1 or pynq z2. can i install the .so files seperately?  
i tried removing that line from the setup.py where it checks if the board is a pynq z1 ,z2 or not , but still it gives errors like no pynq module found .

---

<div class="post-metadata">

**Author:** ![ambarish](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@ambarish](https://discuss.pynq.io/u/ambarish)\
**Post date:** [June 20, 2019, 9:24am UTC](https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231/7 "2019-06-20T09:24:21Z")

</div>

I tried installing the repo to the board by removing the lines from setup.py which says stop the installation for any other boards other than pynq z1 or z2. still the same error results.  
cant find the .so files.  
error is : **OSError: cannot load library ‘/usr/local/lib/python3.6/dist-packages/lstm/libraries/plain/W2A4/libhw-plain-W2A4-ocr-pynq.so’: libsds\_lib.so: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find\_library() did not manage to locate a library called ‘/usr/local/lib/python3.6/dist-packages/lstm/libraries/plain/W2A4/libhw-plain-W2A4-ocr-pynq.so’**

I dont find any python 3.6 on my computer. where should this directory exactly be ?

---

<div class="post-metadata">

**Author:** ![ambarish](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@ambarish](https://discuss.pynq.io/u/ambarish)\
**Post date:** [June 21, 2019, 8:12am UTC](https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231/8 "2019-06-21T08:12:49Z")

</div>

Ok there is a problem with pynq v2.4 probably which goes away if we create a symbolic link from libcma.so with the libsds\_lib.so both in usr/lib

That solves the error.

---

<div class="post-metadata">

**Author:** ![r1marcus](https://avatars.discourse-cdn.com/v4/letter/r/77aa72/32.png) [@r1marcus](https://discuss.pynq.io/u/r1marcus)\
**Post date:** [September 12, 2019, 12:48pm UTC](https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231/9 "2019-09-12T12:48:26Z")

</div>

Hey,  
i try to implement the LSTM to an ULTRA96 Board.

my steps where:

1. Rewrite all Sythesis scripts and tcl to Ultra96

2. copied the \*.so file, the tcl, and the bitstream file to the board

3. now i get the same error:

do you know what do to?  
or what do you mean to creat a symbolic link?

---

<div class="post-metadata">

**Author:** ![rock](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rock/32/32_2.png) [@rock](https://discuss.pynq.io/u/rock)\
**Post date:** [September 12, 2019, 4:54pm UTC](https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231/10 "2019-09-12T16:54:30Z")

</div>

There are several tips. You can have a look at the example repo here:

> **[GitHub - sfox14/pynq-ekf: A multi-board Extended Kalman Filter (EKF)](https://github.com/sfox14/pynq-ekf)**
>
> A multi-board Extended Kalman Filter (EKF). Contribute to sfox14/pynq-ekf development by creating an account on GitHub.

First thing is you need to compile pynqlib along with your source code when generating .so file:

> <https://github.com/sfox14/pynq-ekf/blob/master/build/example.mk#L46>

Second thing is you need to set library path:

> <https://github.com/sfox14/pynq-ekf/blob/master/ekf/ekf.py#L51>

You can also have a look at the example notebooks in boards folder.

---

<div class="post-metadata">

**Author:** ![r1marcus](https://avatars.discourse-cdn.com/v4/letter/r/77aa72/32.png) [@r1marcus](https://discuss.pynq.io/u/r1marcus)\
**Post date:** [September 13, 2019, 9:15am UTC](https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231/11 "2019-09-13T09:15:47Z")

</div>

i am a beginner with FPGA do you may have me some more tips?

may important for you:  
i changed some .tcl and the make-hw script to execute everything on the ultra96:

> **[GitHub - r1marcus/LSTM-PYNQ-ULTRA96](https://github.com/r1marcus/LSTM-PYNQ-ULTRA96)**
>
> Contribute to r1marcus/LSTM-PYNQ-ULTRA96 development by creating an account on GitHub.

and now i get the error:

> <https://github.com/Xilinx/LSTM-PYNQ/issues/10>
>
> Hello i try to get the LSTM to the ULTRA96 board:
> 
> i rewrite the skripts the w…ay you do it in BNN-Pynq
> and i can Sythesied it correctly
> 
> now when i want to excecute the notebook with the new bitstream file i get this error:
> 
> \`OSError Traceback (most recent call last)
> \<ipython-input-3-7f222a2674bf\> in \<module\>()
> \----\> 1 W2A2\_hw\_ocr = lstm.PynqPlainOCR(network="W2A2", runtime=lstm.RUNTIME\_HW)
> 2 W2A2\_hw\_result = W2A2\_hw\_ocr.inference(im)
> 3 W2A2\_hw\_mops\_per\_s, W2A2\_hw\_ms\_inference\_time, W2A2\_hw\_recognized\_text = W2A2\_hw\_result
> 4 W2A2\_hw\_ocr.cleanup()
> 5 
> 
> /usr/local/lib/python3.6/dist-packages/lstm/ocr.py in \_\_init\_\_(self, runtime, network, load\_overlay)
> 92 network,
> 93 load\_overlay,
> \---\> 94 PlainImagePreprocessor(self.input\_size, int(network\[-1\])))
> 95 
> 96 @property
> 
> /usr/local/lib/python3.6/dist-packages/lstm/ocr.py in \_\_init\_\_(self, runtime, dataset, network, load\_overlay, preprocessor)
> 42 
> 43 def \_\_init\_\_(self, runtime, dataset, network, load\_overlay, preprocessor):
> \---\> 44 super(PynqOCR, self).\_\_init\_\_(runtime, dataset, network, load\_overlay)
> 45 self.alphabet\_path = os.path.join(LSTM\_DATA\_DIR, dataset, "alphabet.txt")
> 46 self.preprocessor = preprocessor
> 
> /usr/local/lib/python3.6/dist-packages/lstm/lstm.py in \_\_init\_\_(self, runtime, dataset, network, load\_overlay)
> 62 if dllname not in self.\_libraries:
> 63 self.\_libraries\[dllname\] = self.\_ffi.dlopen(
> \---\> 64 os.path.join(LSTM\_LIB\_DIR, dataset, network, dllname))
> 65 self.interface = self.\_libraries\[dllname\]
> 66 self.\_ffi.cdef(self.ffi\_interface)
> 
> /usr/lib/python3/dist-packages/cffi/api.py in dlopen(self, name, flags)
> 139 assert isinstance(name, basestring) or name is None
> 140 with self.\_lock:
> \--\> 141 lib, function\_cache = \_make\_ffi\_library(self, name, flags)
> 142 self.\_function\_caches.append(function\_cache)
> 143 self.\_libraries.append(lib)
> 
> /usr/lib/python3/dist-packages/cffi/api.py in \_make\_ffi\_library(ffi, libname, flags)
> 800 def \_make\_ffi\_library(ffi, libname, flags):
> 801 backend = ffi.\_backend
> \--\> 802 backendlib = \_load\_backend\_lib(backend, libname, flags)
> 803 #
> 804 def accessor\_function(name):
> 
> /usr/lib/python3/dist-packages/cffi/api.py in \_load\_backend\_lib(backend, name, flags)
> 795 if first\_error is not None:
> 796 msg = "%s. Additionally, %s" % (first\_error, msg)
> \--\> 797 raise OSError(msg)
> 798 return backend.load\_library(path, flags)
> 799 
> 
> OSError: cannot load library '/usr/local/lib/python3.6/dist-packages/lstm/libraries/plain/W2A2/libhw-plain-W2A2-ocr-pynq.so': /usr/local/lib/python3.6/dist-packages/lstm/libraries/plain/W2A2/libhw-plain-W2A2-ocr-pynq.so: wrong ELF class: ELFCLASS32. Additionally, ctypes.util.find\_library() did not manage to locate a library called '/usr/local/lib/python3.6/dist-packages/lstm/libraries/plain/W2A2/libhw-plain-W2A2-ocr-pynq.so'\`

---

<div class="post-metadata">

**Author:** ![rock](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rock/32/32_2.png) [@rock](https://discuss.pynq.io/u/rock)\
**Post date:** [October 3, 2019, 12:44am UTC](https://discuss.pynq.io/t/after-transferring-tcl-and-bitstream-to-pynq-how-to-use-it/231/12 "2019-10-03T00:44:03Z")

</div>

I think the error comes from the incompatibility of the so files. You cannot simply take their so files since they are probably built against pynq-z1 or pynq-z2 boards. For ultra96 you need to rebuild those so files (ultra96 is aarch64, as opposed to armv7l on pynq-z1/z2).
