Exe Not working on different PCs

1,254 views
Skip to first unread message

Stephen Parkes

unread,
May 21, 2021, 12:40:22 PM5/21/21
to PyInstaller
Hi Guys,
I've successfully created an exe of my python program using pyinstaller. Its an application built using PyQt5 and I'm using Python 3.9. It works perfectly on 3 PCs in my office, but when deployed to some PCs it doesn't run.
All PC's were running Win10, some had python installed, some didn't.

I've tried running it from command line on the PCs that don't work, and nothing is printed in the output. I also tried to compile it with debug switched on and exectly the same information is printed to the command line on all PCs. On PCs where the program runs successfully the UI loads, the others it just stops with no errors.

I've tried inserting print statements to see where it gets to but it doesn't get that far. As no errors can be found I'm really after a way to debug the problem as I'm stumped.
Any advice on how to source the problem or what could be the difference between the machines would be much appreciated.
Cheers

bwoodsend

unread,
May 21, 2021, 2:27:05 PM5/21/21
to PyInstaller
Running on one PC but not another usually translates as missing a DLL which some PCs have already. Are you using Conda? That's a common culprit. And what's your PyInstaller version?

Steve Barnes

unread,
May 22, 2021, 1:51:04 AM5/22/21
to pyins...@googlegroups.com

Most likely is a missing (but commonly found) DLL on those machines that it doesn't run on - the most likely candidates being those in the MS Redistribable.

 

One trick that I have found to help is to build the application with a second target set as command line  rather than Windows - this results  in an executable with the annoying habit of opening a command prompt when running but prevents some of the error messages being shunted to NUL - it is worth a try at least. Another is to try, on one of the machines where your app doesn't run it to try installing python (with it added to the path) then see if your code runs, if it doesn't try pip installing the python packages one by one until it does.

 

Steve Barnes

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/8c1f2a5f-54a3-423e-aa17-5fb7f7d3f15cn%40googlegroups.com.

stephen...@gmail.com

unread,
May 22, 2021, 10:29:48 AM5/22/21
to pyins...@googlegroups.com

Thanks for your fast response. I’m not using Conda, standard python. Pyinstaller version 4.1.

Is there a way to detect what DLL is missing when no error is printed? Or where should I be comparing the dll’s between working and not working PCs.

Cheers,

 

 


Sent: Saturday, 22 May 2021 3:59 AM
To: PyInstaller <pyins...@googlegroups.com>

--
You received this message because you are subscribed to a topic in the Google Groups "PyInstaller" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyinstaller/A-aqJ8JIpdE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/56c995a7-e415-47cc-a6e6-473d499f5138n%40googlegroups.com.

Eric Fahlgren

unread,
May 22, 2021, 2:28:56 PM5/22/21
to pyins...@googlegroups.com
Have you ever used the venerable Dependency Walker?  It's ancient, but it still works for me on Win 10, although it sometimes takes 5-10 minutes to start up these days.  Since it's just two files (depends.exe and depends.dll, the .chm is just help so you can ignore it), you can easily put it on a USB stick and run it on one of the affected machines.


You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/014501d74e93%24aa4d2320%24fee76960%24%40gmail.com.

bwoodsend

unread,
May 24, 2021, 2:51:33 PM5/24/21
to PyInstaller

We’ve recently had to expand the list of Windows DLLs to be collected by default. The new ones to look out for are:

  • msvcp140_1.dll
  • msvcp140_2.dll
  • vcruntime140_1.dll
  • vcomp140.dll

I’d guess that it’s either one of those or one of the tiny win-crt-api.dll DLLs.

I’d ditto the suggestion to try using Dependency Walker. Or you can use psutil. Put this at the end of your code:

import psutil

# Get this process i.e. Python.
process = psutil.Process()

# Print all loaded DLLs.
for i in process.memory_maps():
    print(i.path)

In either case, there will be a fair amount of sifting through file names and guess work required to find the DLL you don’t have.

stephen...@gmail.com

unread,
May 26, 2021, 4:39:11 AM5/26/21
to pyins...@googlegroups.com

Thanks for your help everyone I now have the exe working all PC’s.

I tried DependencyWalker which didn’t find anything useful, but using psutil was able to find the missing DLL’s and pyd files.

Numpy and GDAL (osgeo) were the source of the missing libraries. I’m using numpy +mkl 1.19.4 downloaded from Christoph Gohlke’s page and

GDAL 3.2.1 from the same site.

In both cases some but not all required libraries were collected during the build, ones not collected were:

 

numpy\DLLs\mkl_def.dll

numpy\DLLs\mkl_core.dll

numpy\DLLs\mkl_vml_def.dll

numpy\DLLs\mkl_intel_thread.dll – the exe didn’t run on any PC without this DLL

numpy\DLLs\mkl_vml_def.dll

numpy\DLLs\libiomp5md.dll

numpy\DLLs\tbbmalloc.dll

osgeo\_osr.cp39-win_amd64.pyd

osgeo\_ogr.cp39-win_amd64.pyd

osgeo\_gdalconst.cp39-win_amd64.pyd

 

The osgeo\data\proj folder is also NOT copied during the build.

 

Was also missing

tcl\reg1.3\tclreg13.dll

 

Not sure if all these were required, but I included all these as “datas” for my build.

Reply all
Reply to author
Forward
0 new messages