cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Contributor
Contributor
728 Views
Registered: ‎07-15-2019

vart problem

Jump to solution

hi,

  I am trying VART python code, but at runtime it prompts me that there is no module named cv2 and numpy. Have I forgotten anything to install? And it cannot install via apt-get install python-opencv on zcu102.

  I used this image :https://www.xilinx.com/bin/public/openDownload?filename=xilinx-zcu102-dpu-v2019.2-v2.img.gz

   ylh

Tags (1)
0 Kudos
Reply
1 Solution

Accepted Solutions
Moderator
Moderator
719 Views
Registered: ‎08-16-2018

Hi @qwqw0001 

Issue 1 : Python can't find opencv 

[Answer] : Are you using 'python' instead of 'python3' while running the script. Please try to run using python3 as shown below

python3 inception_v1.py 1 model_dir_for_zcu102


The command python will invoke Python2 which does not have 'opencv' as shown below, 

root@xilinx-zcu104-2019_2:~# python
Python 2.7.15 (default, Mar 17 2020, 04:51:25)
[GCC 8.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cv2

The command python3 will invoke python3 which has opencv installed, 

root@xilinx-zcu104-2019_2:~# python3
Python 3.5.6 (default, Mar 17 2020, 04:56:43)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> 

 

 

 

Issue 2 : How to install python package 

[Answer] : Use pip3 install <package name>  (instead of pip install)

 

Issue 3: How to use Jupyter notebook

[Answer] : 

  • Install jupyter on FPGA 
pip3 install jupyter notebook
  • Run the jupyter notebook. Here, 192.168.0.5 is the ip address of the board. 
jupyter notebook --ip='192.168.0.5' --port=8888 --allow-root

        To access the notebook, open this file in a browser:
            file:///home/root/.local/share/jupyter/runtime/nbserver-3116-open.html
        Or copy and paste one of these URLs:
            http://192.168.0.5:8888/?token=14a9c10b10f61432f91569050c02d26989c42f21040ef304
         or http://127.0.0.1:8888/?token=14a9c10b10f61432f91569050c02d26989c42f21040ef304

 

  •  Open the link which is shown in the above output on your host machine, 
http://192.168.0.5:8888/?token=14a9c10b10f61432f91569050c02d26989c42f21040ef304
  • You will see the output like below, 

Screenshot_2.jpg

 


/ 7\7     Meher Krishna Patel, PhD
\ \        Senior Product Application Engineer, Xilinx
/ /        
\_\/\7   It is not so much that you are within the cosmos as that the cosmos is within you...

View solution in original post

6 Replies
Moderator
Moderator
720 Views
Registered: ‎08-16-2018

Hi @qwqw0001 

Issue 1 : Python can't find opencv 

[Answer] : Are you using 'python' instead of 'python3' while running the script. Please try to run using python3 as shown below

python3 inception_v1.py 1 model_dir_for_zcu102


The command python will invoke Python2 which does not have 'opencv' as shown below, 

root@xilinx-zcu104-2019_2:~# python
Python 2.7.15 (default, Mar 17 2020, 04:51:25)
[GCC 8.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cv2

The command python3 will invoke python3 which has opencv installed, 

root@xilinx-zcu104-2019_2:~# python3
Python 3.5.6 (default, Mar 17 2020, 04:56:43)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> 

 

 

 

Issue 2 : How to install python package 

[Answer] : Use pip3 install <package name>  (instead of pip install)

 

Issue 3: How to use Jupyter notebook

[Answer] : 

  • Install jupyter on FPGA 
pip3 install jupyter notebook
  • Run the jupyter notebook. Here, 192.168.0.5 is the ip address of the board. 
jupyter notebook --ip='192.168.0.5' --port=8888 --allow-root

        To access the notebook, open this file in a browser:
            file:///home/root/.local/share/jupyter/runtime/nbserver-3116-open.html
        Or copy and paste one of these URLs:
            http://192.168.0.5:8888/?token=14a9c10b10f61432f91569050c02d26989c42f21040ef304
         or http://127.0.0.1:8888/?token=14a9c10b10f61432f91569050c02d26989c42f21040ef304

 

  •  Open the link which is shown in the above output on your host machine, 
http://192.168.0.5:8888/?token=14a9c10b10f61432f91569050c02d26989c42f21040ef304
  • You will see the output like below, 

Screenshot_2.jpg

 


/ 7\7     Meher Krishna Patel, PhD
\ \        Senior Product Application Engineer, Xilinx
/ /        
\_\/\7   It is not so much that you are within the cosmos as that the cosmos is within you...

View solution in original post

Contributor
Contributor
666 Views
Registered: ‎07-15-2019

hi @meherp 

    You are right, it is running when I use python3. And I also have two problems:

    1) Can I use Juputer notebook in ZCU102? When I connect to its IP address through a browser, Juputer notebook does not work.It was very convenient to use Juputer notebook on PYNQ before.

    2) How do I install some python libraries on zcu102, like tqdm. It can't seem to be installed online via apt-get install?

    ylh

Tags (1)
Moderator
Moderator
655 Views
Registered: ‎08-16-2018

Hi @qwqw0001 

You can install libraries using 'pip3 install <library name>' (again do not use pip). 

Regarding Jupyter-note book : I am not sure about it. I will check and update the post.  


/ 7\7     Meher Krishna Patel, PhD
\ \        Senior Product Application Engineer, Xilinx
/ /        
\_\/\7   It is not so much that you are within the cosmos as that the cosmos is within you...
0 Kudos
Reply
Contributor
Contributor
645 Views
Registered: ‎07-15-2019

hi @meherp 

    Yes, pip3 is ok ,thanks.

    ylh

Tags (1)
Moderator
Moderator
581 Views
Registered: ‎08-16-2018

Hi @qwqw0001 

You can use the jupyter notebook as well. 

 

  • Install jupyter 
pip3 install jupyter notebook
  • Run the jupyter notebook. Here, 192.168.0.5 is the ip address of the board. 
jupyter notebook --ip='192.168.0.5' --port=8888 --allow-root

        To access the notebook, open this file in a browser:
            file:///home/root/.local/share/jupyter/runtime/nbserver-3116-open.html
        Or copy and paste one of these URLs:
            http://192.168.0.5:8888/?token=14a9c10b10f61432f91569050c02d26989c42f21040ef304
         or http://127.0.0.1:8888/?token=14a9c10b10f61432f91569050c02d26989c42f21040ef304

 

  •  Open the link which is shown in the above output on your host machine, 
http://192.168.0.5:8888/?token=14a9c10b10f61432f91569050c02d26989c42f21040ef304
  • You will see the output like below, 

Screenshot_2.jpg

 

I am putting everything in the first reply as well so that others can find all the answers at one place

 


/ 7\7     Meher Krishna Patel, PhD
\ \        Senior Product Application Engineer, Xilinx
/ /        
\_\/\7   It is not so much that you are within the cosmos as that the cosmos is within you...
Visitor
Visitor
236 Views
Registered: ‎12-30-2019
How can I use opencv in python2 ??? I'm worried about this for a long time!
0 Kudos
Reply