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
Beginner
5,438 Views

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 Kudos
1 Solution
Srujana
Employee
5,390 Views

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 

View solution in original post

9 Replies
Sahira_Intel
Moderator
5,438 Views

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 Kudos
Imura__Shigeo
Beginner
5,439 Views

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 Kudos
Imura__Shigeo
Beginner
5,439 Views

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 Kudos
Srujana
Employee
5,436 Views

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 Kudos
Imura__Shigeo
Beginner
5,418 Views

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 Kudos
Srujana
Employee
5,391 Views

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
Beginner
5,367 Views

I tried it and it worked fine.

Excellent!


Thank you for your help.

0 Kudos
MH8940
Beginner
3,869 Views

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 Kudos
Reply