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.

Are pyinstaller and openvino incompatible?

Imura__Shigeo
초급자
6,477 조회수

Hi

Are pyinstaller and openvino incompatible?

If you run the following code directly on Windows 10 with "w_openvino_toolkit_p_2020.1.033" installed 

start
end

is displayed.

----------------------------------------------
import numpy as np
from openvino.inference_engine import IENetwork, IECore

print("start")
e = IECore()
print("end")
----------------------------------------------

But when I run the exe'd file with pyinstaller.

start

only 

Is there something to be set up? 

Thank you very much.

0 포인트
1 솔루션
Srujana
직원
6,429 조회수

Hi @Imura__Shigeo 

I tried converting your python sample to .exe and I was able to see both Start and End on running the .exe

For that I used the following command to create .exe. We need to give dependency files for iecore() to work. Here plugins.xml helps the sample to load the required plugins. In our case its  MKLDNNPlugin for CPU.

pyinstaller --onefile --add-data "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\inference_engine\bin\intel64\Release\plugins.xml;." demo_sample.py

Here is the output..

Srujana_0-1593429803734.png

Regards,

Srujana 

원본 게시물의 솔루션 보기

9 응답
Sahira_Intel
중재자
6,477 조회수

Hi Shigeo,

There should not be an incompatibility with pyinstaller and openvino. Can you please provide the error you are getting? 

Just a note: OpenVINO 2020.2 has also been released! I would recommend installing the latest version and trying again. 

Best Regards,

Sahira 

0 포인트
Imura__Shigeo
초급자
6,478 조회수

Hi Sahira.

 

Unfortunately, it's over without a message.

The following is the content displayed.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

D:\Develop\Python\dlibtest>C:/Python36/python.exe d:/Develop/Python/dlibtest/test.py
start
end

D:\Develop\Python\dlibtest>dist\test.exe
start

D:\Develop\Python\dlibtest>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 I tried openvino2020.2. but It was the same.

Thank you.

 

 

 

0 포인트
Imura__Shigeo
초급자
6,478 조회수

Hi Sahira.

 

It's been a while.

 I tried openvino2020.3, then I get an error message.

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

D:\Develop\Python\dlibtest>C:/Python36/python.exe d:/Develop/Python/dlibtest/test.py
start
end

D:\Develop\Python\dlibtest>dist\test.exe
Traceback (most recent call last):
  File "site-packages\PyInstaller\loader\rthooks\pyi_rth_pkgres.py", line 11, in <module>
  File "c:\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module    
    exec(bytecode, module.__dict__)
  File "site-packages\pkg_resources\__init__.py", line 86, in <module>
ModuleNotFoundError: No module named 'pkg_resources.py2_warn'
[11808] Failed to execute script pyi_rth_pkgres

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Does this give you a clue as to how to solve the problem?

 

Thank you.

 

 

0 포인트
Srujana
직원
6,475 조회수

Hi  @Imura__Shigeo 

I was able to fix the same issue by upgrading the setup tools.

pip3 install --upgrade 'setuptools<45.0.0'

Hope it helps!!

 

0 포인트
Imura__Shigeo
초급자
6,457 조회수

Hi.

Thank you for your reply.


When I replaced the setuptools with the old ones as you mentioned, the error disappeared completely.

Thank you for the tip on what to do when pyinstaller doesn't work.

However, the "end" doesn't show up when I run the exe.

This is the same as below.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

D:\Develop\Python\dlibtest>C:/Python36/python.exe d:/Develop/Python/dlibtest/test.py
start
end

D:\Develop\Python\dlibtest>dist\test.exe
start

D:\Develop\Python\dlibtest>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thank you.

0 포인트
Srujana
직원
6,430 조회수

Hi @Imura__Shigeo 

I tried converting your python sample to .exe and I was able to see both Start and End on running the .exe

For that I used the following command to create .exe. We need to give dependency files for iecore() to work. Here plugins.xml helps the sample to load the required plugins. In our case its  MKLDNNPlugin for CPU.

pyinstaller --onefile --add-data "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\inference_engine\bin\intel64\Release\plugins.xml;." demo_sample.py

Here is the output..

Srujana_0-1593429803734.png

Regards,

Srujana 

Imura__Shigeo
초급자
6,406 조회수

I tried it and it worked fine.

Excellent!


Thank you for your help.

0 포인트
MH8940
초급자
4,908 조회수

Hi, @Srujana 

I followed your suggestion and added plugins.xml to my pyinstaller cmd argument,

It can produce .exe file, however when I execute it, I got following error,

how can I fix it?

 

MH8940_0-1641365624835.png

(my pip install openvino version is 2021.4.2

and execute following command on terminal to produce the exe file:

 

pyinstaller --noconfirm --onedir --windowed --icon "C:/Users/USER/Desktop/lab5/media/ultrasound_icon.ico" --debug "all" --add-data "C:/Users/USER/Desktop/lab5/media;media/" --add-data "C:/Users/USER/Desktop/AIGO/lab5/model_IR;model_IR/" --add-data "C:/Program Files (x86)/Intel/openvino_2021.4.752/inference_engine/bin/intel64/Release/plugins.xml;." "C:/Users/USER/Desktop/lab5/UI.py"

 

in the "lab5" folder, file structure as below:

MH8940_1-1641365973898.png

 

0 포인트
응답