Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6575 讨论

Import cv2 error: undefined symbol: _ZNK6ngraph4Node9get_autobEv

simranS
初学者
5,414 次查看

Hi I am trying to inference inside openvino with Intel python distribution using the following Command, but it throws an cv2 error:

Openvino Version: 2021.1

Intel Python Distribution: Python 3.7.7 :: Intel Corporation

Error:

/opt/intel/openvino_2021/deployment_tools/inference_engine/samples/python/object_detection_sample_ssd$ python object_detection_sample_ssd.py -m /home/ubuntu/Documents/Simran/frozen_inference_graph.xml -i /home/ubuntu/Documents/Simran/images/images_2_134.jpg
Traceback (most recent call last):
File "object_detection_sample_ssd.py", line 21, in <module>
import cv2
ImportError: /opt/intel/openvino_2021/deployment_tools/inference_engine/lib/intel64/libinference_engine_transformations.so: undefined symbol: _ZNK6ngraph4Node9get_autobEv

 

I have tried the following links to resolve it but the issue still exists:

Kindly provide assistance.

标签 (1)
0 项奖励
8 回复数
Maksim_S_Intel
5,396 次查看

It looks like wrong version of OpenCV is being loaded. Please check your environment, make sure PYTHONPATH and LD_LIBRARY_PATH are set correctly.

0 项奖励
simranS
初学者
5,390 次查看

I have switched now to openvino version 2019R3 and the error now is :

Traceback (most recent call last):
File "object_detection_sample_ssd.py", line 21, in <module>
import cv2
ImportError: No module named cv2

My OpenCV version is 3.4.2

What should be the correct PYTHONPATH and LD_LIBRARY PATH? The output of the existing paths are shown below:

echo $PYTHONPATH

 /opt/intel/openvino_2019.3.376/python/python3.6:/opt/intel/openvino_2019.3.376/python/python3:/opt/intel/openvino_2019.3.376/deployment_tools/open_model_zoo/tools/accuracy_checker:/opt/intel/openvino_2019.3.376/deployment_tools/model_optimizer:

echo $LD_LIBRARY_PATH

/home/ubuntu/Downloads/intelpython3/lib/libfabric:/opt/intel/openvino_2019.3.376/opencv/lib:/opt/intel/opencl:/opt/intel/openvino_2019.3.376/deployment_tools/inference_engine/external/hddl/lib:/opt/intel/openvino_2019.3.376/deployment_tools/inference_engine/external/gna/lib:/opt/intel/openvino_2019.3.376/deployment_tools/inference_engine/external/mkltiny_lnx/lib:/opt/intel/openvino_2019.3.376/deployment_tools/inference_engine/external/tbb/lib:/opt/intel/openvino_2019.3.376/deployment_tools/inference_engine/lib/intel64:/opt/intel/openvino_2019.3.376/openvx/lib:

 

0 项奖励
Maksim_S_Intel
5,385 次查看

Since you are using OpenVINO 2021 your PYTHONPATH should contain "/opt/intel/openvino_2021/python/python3" and LD_LIBRARY_PATH should contain "/opt/intel/openvino_2021/opencv/lib". These variables are set by the "/opt/intel/openvino_2021/bin/setupvars.sh" script. See https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_linux.html#set-the-environment-variables for details.

0 项奖励
IntelSupport
管理员
5,361 次查看

Hi SimranS,

 

It might cause by the OpenVINO environment is set with the correct version. Since you have other versions of OpenVINO installed on your machine, please make sure you are setting the OpenVINO environment according to the version carefully. It is important to set the correct environment variables exactly for the 2021.1 builds.

Also, please ensure you carefully followed all the additional installation steps from the OpenVINO website.

https://docs.openvinotoolkit.org/2021.1/openvino_docs_install_guides_installing_openvino_linux.html#additional-NCS-steps

 

Regards,

Aznie


0 项奖励
simranS
初学者
5,344 次查看

Hi, 

I have checked the PYTHONPATH and LD_LIBRARY_PATH, seem correct.

(base) ubuntu@ubuntu:~/Downloads/intelpython3$ echo $PYTHONPATH
/opt/intel/openvino_2019.3.376/python/python3.6:/opt/intel/openvino_2019.3.376/python/python3:/opt/intel/openvino_2019.3.376/deployment_tools/open_model_zoo/tools/accuracy_checker:/opt/intel/openvino_2019.3.376/deployment_tools/model_optimizer:


(base) ubuntu@ubuntu:~/Downloads/intelpython3$ echo $LD_LIBRARY_PATH
/home/ubuntu/Downloads/intelpython3/lib/libfabric:/opt/intel/openvino_2019.3.376/opencv/lib:/opt/intel/opencl:/opt/intel/openvino_2019.3.376/deployment_tools/inference_engine/external/hddl/lib:/opt/intel/openvino_2019.3.376/deployment_tools/inference_engine/external/gna/lib:/opt/intel/openvino_2019.3.376/deployment_tools/inference_engine/external/mkltiny_lnx/lib:/opt/intel/openvino_2019.3.376/deployment_tools/inference_engine/external/tbb/lib:/opt/intel/openvino_2019.3.376/deployment_tools/inference_engine/lib/intel64:/opt/intel/openvino_2019.3.376/openvx/lib:

This cv import error only arises inside Intel python distribution environment when I try to run inference engine.

(base) ubuntu@ubuntu:/opt/intel/openvino_2019.3.376/deployment_tools/inference_engine/samples/python_samples/object_detection_sample_ssd$ sudo python object_detection_sample_ssd.py -m /home/ubuntu/Downloads/frozen_inference_graph.xml -i /home/ubuntu/Downloads/images/pics_1_124.jpg
Traceback (most recent call last):
File "object_detection_sample_ssd.py", line 21, in <module>
import cv2
ImportError: No module named cv2

 

Where as importing cv2 inside python shell doesnot give any error:

(base) ubuntu@ubuntu:~/Downloads/intelpython3$ python
Python 3.7.7 (default, Sep 11 2020, 20:43:12)
[GCC 7.3.0] :: Intel Corporation on linux
Type "help", "copyright", "credits" or "license" for more information.
Intel(R) Distribution for Python is brought to you by Intel Corporation.
Please check out: https://software.intel.com/en-us/python-distribution
>>> import cv2
>>>

Also attached screenshots for the same.

0 项奖励
Maksim_S_Intel
5,338 次查看

Running python with sudo does not preserve environment, try "sudo -E"  (see https://linux.die.net/man/8/sudo).  On some platforms "sudo" can drop LD_LIBRARY_PATH even with "-E" option for security reasons (see https://superuser.com/questions/544518/sudo-e-not-passing-all-variables).

Are you sure you need "sudo"? All samples should be able to run with regular user privilege level.

0 项奖励
IntelSupport
管理员
5,334 次查看

Hi,

I noticed from your $PYTHONPATH, it shows that you have the Python 3.6 version. If you are running the OpenVINO inference engine using Python 3.6, please make sure you have installed the OpenCV for Python 3.6 in the OpenVINO environment.

 

Refer to this OpenVINO installation steps carefully from the following link. https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_linux.html

 

Regards,

Aznie


0 项奖励
IntelSupport
管理员
5,269 次查看

Hi SimranS,

This thread will no longer be monitored since we have provided a solution. If you need any additional information from Intel, please submit a new question.


Regards,

Aznie


0 项奖励
回复