06-06-2020 09:37 AM
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
06-06-2020 10:07 AM - edited 06-07-2020 08:43 AM
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] :
pip3 install jupyter notebook
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
http://192.168.0.5:8888/?token=14a9c10b10f61432f91569050c02d26989c42f21040ef304
06-06-2020 10:07 AM - edited 06-07-2020 08:43 AM
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] :
pip3 install jupyter notebook
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
http://192.168.0.5:8888/?token=14a9c10b10f61432f91569050c02d26989c42f21040ef304
06-06-2020 10:00 PM
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
06-06-2020 10:57 PM
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.
06-06-2020 11:30 PM
06-07-2020 06:15 AM - edited 06-07-2020 08:41 AM
Hi @qwqw0001
You can use the jupyter notebook as well.
pip3 install jupyter notebook
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
http://192.168.0.5:8888/?token=14a9c10b10f61432f91569050c02d26989c42f21040ef304
I am putting everything in the first reply as well so that others can find all the answers at one place
11-07-2020 06:46 AM