Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from .ie_api import * ImportError: DLL load failed: The specified module could not be found #478

Closed
qbTrible opened this issue Apr 30, 2020 · 17 comments
Assignees
Labels
category: Python API OpenVINO Python bindings

Comments

@qbTrible
Copy link

I try to inference YOLOv3 by openvino, there is an ie "api.pyd" file in the interface_engine folder of python3.6 folder.
Any method shown in this thread,all done.
Please teach me the tip to solve the error.


OpenVINO 2020.1
OS:Windows10 Pro v1909 OS build 18363.418
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32


python object_detection_demo_yolov3_async.py -m pf/yolov3.xml -i test.jpg

from modules.inference_engine import InferenceEngine
File "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\open_model_zoo\demos\python_demos\human_pose_estimation_3d_demo\modules\inference_engine.py", line 19, in
from openvino.inference_engine import IENetwork, IECore
File "C:\Program Files (x86)\IntelSWTools\openvino\python\python3.6\openvino\inference_engine_init_.py", line 1, in
from .ie_api import *
ImportError: DLL load failed: The specified module could not be found

@avitial
Copy link
Contributor

avitial commented May 8, 2020

@qbTrible is not very clear what the steps are to get to this problem. Make sure if you are running the object_detection_demo_yolov3_async.py script on a CMD terminal to setup the environment variables running the setupvars.bat script under _C:\Program Files (x86)\IntelSWTools\openvino\bin_ directory.

Have you verified your installation of OpenVINO using verification scripts prior to running YoloV3 demo app? This error looks like a configuration mistake in environment, please make sure to complete all steps given on 2020.1 installation guide for Windows*. Please note there is a newer release available (2020.2 release notes).

Regards,
Luis

@ilya-lavrenov ilya-lavrenov added the category: Python API OpenVINO Python bindings label May 24, 2020
@jiwaszki
Copy link
Contributor

jiwaszki commented Jun 5, 2020

Hi @qbTrible! Is the issue resolved?

I had similar error (DLL for OpenCV) when running cross_check_tool. Make sure you have everything set (link in @avitial comment). If problem is still present then manually fix openvino\scripts\setupvars\setupvars.bat commands, so they match your folder structure.

Hope it helps!

-Jan

@ogilg
Copy link

ogilg commented Jul 17, 2020

I got the same exact error when trying "from openvino.inference_engine import IENetwork". However I don't think this is an installation error because when I run the exact same command from the command prompt it works just fine. Also I have run setupvars.bat.
@jiwaszki what do you mean by manually fix the files to match your folder structure? I've looked at them and they seem to have the right folders.

I am running this on PyCharm.
OpenVINO 2020.4.287
Windows 10

from openvino.inference_engine import IECore
Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\JetBrains\PyCharm Community Edition with Anaconda plugin 2020.1.3\plugins\python-ce\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self.system_import(name, *args, **kwargs)
File "C:\Program Files (x86)\IntelSWTools\openvino\python\python3.6\openvino\inference_engine_init
.py", line 1, in
from .ie_api import *
File "C:\Program Files\JetBrains\PyCharm Community Edition with Anaconda plugin 2020.1.3\plugins\python-ce\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: DLL load failed: The specified module could not be found.

@issaiass
Copy link

issaiass commented Aug 1, 2020

I try to inference YOLOv3 by openvino, there is an ie "api.pyd" file in the interface_engine folder of python3.6 folder.
Any method shown in this thread,all done.
Please teach me the tip to solve the error.

OpenVINO 2020.1
OS:Windows10 Pro v1909 OS build 18363.418
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32

python object_detection_demo_yolov3_async.py -m pf/yolov3.xml -i test.jpg

from modules.inference_engine import InferenceEngine
File "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\open_model_zoo\demos\python_demos\human_pose_estimation_3d_demo\modules\inference_engine.py", line 19, in
from openvino.inference_engine import IENetwork, IECore
File "C:\Program Files (x86)\IntelSWTools\openvino\python\python3.6\openvino\inference_engine__init__.py", line 1, in
from .ie_api import *
ImportError: DLL load failed: The specified module could not be found

Hello i had the same problems.
The problem is that your bindings are not found, probably you are also mixing something:
Another problem could be if you do not have Visual Studio Redistributable 2015 or above installed, but i will assume that is not the case.

This was what i tested and worked, please do the tests:

1 - Create an environment with python 3.5, 3.6, 3.7, in your case will be python 3.6 and install cython, opencv-contrib-python too.

conda create -n opencv-openvino python=3.6
activate opencv-openvino
(opencv-openvino)>>python --version
Python 3.6 :: Anaconda, Inc.
(opencv-openvino)>>pip install cython>=0.29
pip install opencv-contrib-python
quit()

2 - Copy the openvino python version folder to the packages folder

2.1- Check the location of the site-packages

(opencv-openvino)>>pip show pip
Name: pip
Version: 20.2
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: distutils-sig@python.org
License: MIT
Location: c:\users\issai\anaconda3\envs\opencv-openvino\lib\site-packages
Requires:
Required-by:

2.2 - Copy the openvino folder to the site packages folder

For example:
copy this folder: C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\python\python3.6\openvino
throw to this location: c:\users\issai\anaconda3\envs\opencv-openvino\lib\site-packages

3 - Run the setupvars:

NOTE: i made a special change to see the environmental variables, see the pasetbin; https://pastebin.com/4xcce26F
NOTE: OpenCV_DIR must exist on your environmental variables to run the script correctly

(opencv-openvino)>> C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\bin\setupvars.bat
OpenCV Directory exists at C:\OpenCV\OpenCV-4.4.0\opencv\build\install
Below a list of the PYTHONPATH variable

C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\open_model_zoo\tools\accuracy_checker;C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\python\python3.5;C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\python\python3;C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer;

4 - Try to see if you can import IECore and IENetwork

(opencv-openvino)>>python
Python 3.5.6 |Anaconda, Inc.| (default, Aug 26 2018, 16:05:27) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

from openvino.inference_engine import IENetwork, IECore

5 - If above gives no error you are ok.

BONUS: The "probably" easiest way
1 - Created a virtual environment with python=3.5 (IMPORTANT!)
2 - Activate the virtual environment
3 - Install openvino with opencv: pip install opencv-openvino-contrib-python
4 - Run the setupvars
5 - Try to see if you can load IENetwork and IECore


Graphical Steps after the first step (created the virtual environment):
NOTE: Remember i changed the setupvars.bat to see the output
NOTE: Remember OpenCV_DIR is created
NOTE: I have created an environment with python=3.5

2 - Copy the openvino python version folder to the packages folder

2.1 - Check the location of the site-packages
image

2.2 - Copy the openvino folder to the site packages folder
image

image

3 - Run the setupvars.bat
image

4 & 5 - Try to see if you can import IECore and IENetwork; If gives no error you are ok
image

Result image:
image

BONUS: The "probably" easiest way:

image

image

image

@issaiass
Copy link

issaiass commented Aug 1, 2020

Another, but ugly workaround in pycharm could be, if you completed above:

image

@1165048017
Copy link

Another, but ugly workaround in pycharm could be, if you completed above:

image

It does work

@middlemall
Copy link

middlemall commented Aug 18, 2020

image

Reference resources setupvars.bat , and reconfigure the environment variables to solve the above problems
image

@issaiass
Copy link

issaiass commented Aug 18, 2020

image

Reference resources setupvars.bat , and reconfigure the environment variables to solve the above problems
image

Yes, that's basically the problem always, that's why i put the above solutions. Thanks for sharing.

@akuporos
Copy link
Contributor

In order to avoid this problem you should set PYTHONPATH=C:\..\openvino\bin\intel64\Release\python_api\python3.7 and
set PATH=C:\..\openvino\bin\intel64\Release;C:\..\openvino\inference-engine\temp\tbb\bin;%PATH%

@paragjai
Copy link

paragjai commented Dec 18, 2020

Ignore all the comments given above and follow the following steps to resolve the issue on Windows 10 :

  1. Copy all the DLLs from *C:\Program Files (x86)\Intel\openvino_2021.2.185\deployment_tools\inference_engine\bin\intel64\Release* to the same folder where the python file using the inference engine APIs are present (python file will contain statement such as from openvino.inference_engine import IENetwork, IECore).

  2. Open a command prompt, navigate to C:\Program Files (x86)\Intel\openvino_2021.2.185\bin and execute setupvars.bat

  3. If you have created a python environment and installed all the python runtimes inside it, then activate the python environment. Else use your default python installation.

  4. Navigate to the folder containing your application's main python script. Execute your main python script.

@gloomyfish1998
Copy link

version information
openvino 2021.2.185
python SDK 3.8.5
VS2015 Pro
Windows 10 64bit
all above sw installed by default

i can run demo with VS2015

=======================
but when i run python, always get 👎

Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

from openvino.inference_engine import IECore
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\openvino\inference_engine_init_.py", line 1, in
from .ie_api import *
ImportError: DLL load failed while importing ie_api: 找不到指定的模块。
==============================================================

more information
i can run pervious openvino 2020.x in python3.6.5 on my machine
but same configuration does not work for 3.8.5 + 2021.2.185 on windows 10 64bit

please confirm / any suggestion ??

@gloomyfish1998
Copy link

more explain, i already changed all config path, and remove python 3.6.5 and openvino2020.x versions

@jbrownkramer
Copy link

jbrownkramer commented Jan 28, 2021

I have tried every suggestion on this page and I still get this error. I believe there is simply a missing DLL that is neglected in the existing Windows 10 install.

I changed setupvars to point to a copy of python3.6, and now it works fine. I think the problem is python3.8.

@sparrow84001
Copy link

hy find those file
and copy that path
then save Environment Variables
then you good to go (further if u any problem contact me .)
lala

@Im-Himanshu
Copy link

Im-Himanshu commented May 20, 2021

Internally setupvars.sh edit two environment variable to include all openvino directory :

  1. PYTHONPATH
  2. PATH
    Now these variable could easily be setup by running "C:\Program Files (x86)\IntelSWTools\openvino_2021.2.185\bin\setupvars.bat" in the same terminal in which you will run python but this will be temporary i.e. will work only in the current windows

To avoid running setupvars.sh everytime, you can permanently edit edit the environment variable as follows :

Copy the openvino python directory

source: C:\Program Files (x86)\IntelSWTools\openvino_2021.2.185\python\python3.8\openvino
dest : C:\\Users\goyal\Anaconda3\envs\tf2-gpu\lib\site-packages   

Common Step

 create one environment variable named openvino21 with value as C:\Program Files (x86)\IntelSWTools\openvino_2021

Setting up PYTHONPATH variable

  step:1 
  create second env variable named OPENVINO_PYTHONPATH and set its value to this:
  Please Note : change the path according to your python environment as python3.7 or python3.6 in the below path
 %openvino21%\deployment_tools\tools\post_training_optimization_toolkit;%openvino21%\deployment_tools\open_model_zoo\tools\accuracy_checker;%openvino21%\python\python3.8;%openvino21%\python\python3;%openvino21%\deployment_tools\model_optimizer
  
  step:2
  add the above env variable in **PYTHONPATH** variable as %OPENVINO_PYTHONPATH%;

Setting up PATH variable

step : 1
   create second env variable name OPENVINO_PATH and set it to following
   Please Note : change the path according to your python environment as python3.7 or python3.6 in the below path
%openvino21%\opencv\bin;%openvino21%\deployment_tools\ngraph\lib;%openvino21%\deployment_tools\inference_engine\external\tbb\bin;%openvino21%\deployment_tools\inference_engine\bin\intel64\Release;%openvino21%\deployment_tools\inference_engine\bin\intel64\Debug;%openvino21%\deployment_tools\inference_engine\external\hddl\bin;%openvino21%\deployment_tools\model_optimizer;%openvino21%\deployment_tools\inference_engine\bin\intel64;%openvino21%\deployment_tools\ngraph\lib;%openvino21%\deployment_tools\inference_engine\bin;%openvino21%\deployment_tools\open_model_zoo\tools\accuracy_checker;%openvino21%\deployment_tools\tools\post_training_optimization_toolkit;%openvino21%\python\python3.8;%openvino21%\python\python3;

step-2 : add  above env variable to the PATH variable as %OPENVINO_PATH% 

That's it, now the from openvino.inference_engine import IECore should be working from everywhere you open the python environment like pycharm, vs code, terminal, conda environment etc etc

Note : it may mess up your opencv setup, remove the opencv path from OPENVINO_PAT

@evgenii-brovkin
Copy link

If you are using Python 3.8 or higher and installed openvino via pip on Windows then

  • go to your\env\site-packages\openvino\inference_engine
  • open __init__.py
  • look for those lines
    25. if (3, 8) <= sys.version_info:
    26. os.add_dll_directory(os.path.abspath(lib_path))
  • add os.environ['PATH'] = os.path.abspath(lib_path) + ';' + os.environ['PATH'] after the last line

or instead just add your\env\site-packages\openvino\libs folder to the PATH

@sahira-rizvi
Copy link

Closing, feel free to re-open or start a new issues if additional assistance is needed.

Sincerely,
Sahira

redradist pushed a commit to redradist/openvino that referenced this issue Oct 6, 2023
* Add divided

* Update arm_optimizations.cpp

* Enable divide

* Enable FP16 divide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Python API OpenVINO Python bindings
Projects
None yet
Development

No branches or pull requests