cx_Freeze icon indicating copy to clipboard operation
cx_Freeze copied to clipboard

Frozen PySide6 sample not working on other PC

Open brzGatsu opened this issue 2 years ago • 3 comments

Hello,

I can successfully freeze and run the PySide6-SimpleBrowser example on my PC. However, when I copy the frozen app to another (non developer) PC I get an error. I have the same error with my actual project - hoping for a quick resolution, its blocking my next release.

cx_freeze 3.12.0.dev1 PySide6 6.2.4 (same issue 6.3.1)

Error: Traceback (most recent call last): File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\cx_Freeze\initscripts_startup_.py", line 120, in run File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\cx_Freeze\initscripts\console.py", line 16, in run File "simplebrowser.py", line 5, in File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\PySide6_init_.py", line 144, in File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\PySide6_init_.py", line 64, in setupQtDirectories File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\shiboken6_init.py", line 26, in ImportError: DLL load failed: The specified module could not be found.

brzGatsu avatar Aug 25 '22 19:08 brzGatsu

Please check the FAQ.

marcelotduarte avatar Aug 25 '22 23:08 marcelotduarte

Hi, I built again with include_msvcr and verified that the dll is included. I still get an error on the other PC, it changed slightly though.

PySide6/init.py: Unable to import Shiboken from C:\Users\User\Desktop\build\exe.win-amd64-3.7\lib\library.zip, C:\Users\User\Desktop\build\exe.win-amd64-3.7\lib Traceback (most recent call last): File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\cx_Freeze\initscripts_startup_.py", line 120, in run File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\cx_Freeze\initscripts\console.py", line 16, in run File "simplebrowser.py", line 5, in File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\PySide6_init_.py", line 111, in File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\PySide6_init_.py", line 60, in setupQtDirectories File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\shiboken6_init.py", line 25, in ImportError: DLL load failed: The specified module could not be found.

I then tried installing the c++ redist from the link of the FAQ. The installer wouldn't let me proceed because a newer version was already installed: Untitled .

brzGatsu avatar Aug 26 '22 08:08 brzGatsu

I found the issue: python3.dll and python37.dll need to be also present inside the lib folder. Then it works on other PCs too.

brzGatsu avatar Aug 27 '22 10:08 brzGatsu

cx_Freeze 6.12.0 has just been released.

Can you test with 6.12?

marcelotduarte avatar Oct 13 '22 02:10 marcelotduarte

Sorry, I was too quick in closing this - I still had the workaround of copying the python dlls to lib in my buildscript. The problem still exists with cx_freeze 6.12.

brzGatsu avatar Oct 15 '22 15:10 brzGatsu

Can you show me the original contents of the build/exe.win-amd64-3.7 folder and the lib? Actually, I think that if you copy vcruntime* to exe.win-amd64-3.7 also solves. Can you test this?

marcelotduarte avatar Oct 15 '22 16:10 marcelotduarte

The vcruntime already is contained in the build root and another copy in the lib folder. Here are the contents of the build root /lib and /lib/PySide6 dirs (of my project, not the sample)

dir.txt

brzGatsu avatar Oct 15 '22 16:10 brzGatsu

@brzGatsu With my samples I cannot reproduce the error. So, I used the Sephrasto. I commented the 2 lines: https://github.com/Aeolitus/Sephrasto/blob/master/src/Sephrasto/CxFreezeBuild.py#L73-L74 Copied the zip to a cleaner machine. It works! I used python 3.7.9 to build, cx_Freeze 6.12, PySyde6 6.3.2 In my virtualenv is installed strictly the requirements and the requirements of cx_Freeze. I see that in your environment there seem to be other packages like pywin32 (win32api.pyd, win32evtlog.pyd, _win32sysloader.pyd). Try without these packages as they are not required.

marcelotduarte avatar Oct 18 '22 21:10 marcelotduarte

Hello,

thank you for checking this out. You're right, I had some unneeded packages in my env and now set it up according to the requirements.txt. However, the issue is not resolved with that - I retried both Sephrasto and the SimpleBrowser example on a regularily used PC that has no python installed as well as on a freshly installed bare-bones Win 10 PC. The python dlls still need to be copied to the lib folder for the apps to work on either machine.

I added the contents of the SimpleBrowser build root and lib folders root.txt

brzGatsu avatar Oct 21 '22 10:10 brzGatsu

I used python 3.7.9 to build, cx_Freeze 6.12, PySyde6 6.3.2, and you?

marcelotduarte avatar Oct 21 '22 11:10 marcelotduarte

Python 3.7.8, cx_Freeze 6.12 and PySide6 6.3.2

Since this seems to be a path issue, maybe the reason is that I use Visual Studios python installation? (I have the following folder in my env path for using python: C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64)

brzGatsu avatar Oct 21 '22 11:10 brzGatsu

The bug is with Python 3.7.8 Similar issue #1408 (see my last comment). More info: https://bugs.python.org/issue29778#msg373164

marcelotduarte avatar Oct 22 '22 08:10 marcelotduarte

To install the latest development build:

pip install --pre --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze

marcelotduarte avatar Oct 22 '22 16:10 marcelotduarte

cx_Freeze 6.13.0 has just been released.

marcelotduarte avatar Oct 26 '22 03:10 marcelotduarte

Thank you very much! It is fixed now!

brzGatsu avatar Oct 26 '22 08:10 brzGatsu