Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.

Are pyinstaller and openvino incompatible?

Imura__Shigeo
Beginner
1,473 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
1,424 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

8 Replies
Sahira_Intel
Moderator
1,473 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 

Imura__Shigeo
Beginner
1,473 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.

 

 

 

Imura__Shigeo
Beginner
1,473 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.

 

 

Srujana
Employee
1,470 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!!

 

Imura__Shigeo
Beginner
1,452 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.

Srujana
Employee
1,425 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

Srujana
Employee
1,418 Views
Imura__Shigeo
Beginner
1,401 Views

I tried it and it worked fine.

Excellent!


Thank you for your help.

Reply