Start with the directions here and get py2exe and pyqt4 installed with miniconda https://gist.github.com/peteristhegreat/0a05d7029befc5c2a302
Next install the rest of the good stuff
conda install matplotlib
conda install numpy
conda install scipy
Make a simple hello world program that hits all the packages
- https://www.scipy-lectures.org/intro/scipy.html#full-code-examples-for-the-scipy-chapter
- https://www.scipy-lectures.org/intro/numpy/gallery.html#full-code-examples-for-the-numpy-chapter
- https://matplotlib.org/tutorials/introductory/pyplot.html
- https://www.tutorialspoint.com/pyqt/pyqt_hello_world.htm
See main.py below
See setup.py below. It is loosely based on:
- https://stackoverflow.com/questions/11062417/py2exe-with-matplotlib-numpy-and-pylab
- http://www.py2exe.org/index.cgi/MatPlotLib
python setup.py py2exe
See the sample output below
https://stackoverflow.com/questions/34985134/py2exe-mkl-fatal-error-cannot-load-mkl-intel-thread-dll
Go to C:\path\to\miniconda\pkgs\mkl-2018.0.2-1\Library\bin
and copy 4 dll's into your dist folder that py2exe created.
- mkl_core.dll
- mkl_intel_thread.dll
- mkl_mc3.dll
- mkl_rd.dll
Note, that if other dll errors crop up, use depends
if you can, or you can also use a dirty trick that involves deleting folders in windows and let windows tell you where the dlls are.
I've used it many times for Qt deployments in the past, and I wrote it up here: https://stackoverflow.com/questions/17736229/do-i-have-to-include-all-these-qt-dlls-with-my-application
Here is my summary on the process:
- Make a backup of the folder with a bunch of dll's you think python might be using
- Run you python program
- While it is up and running delete the dll folder
- Windows will prevent you from deleting the folder
- Step into the folder and try deleting all the individual dlls
- Windows will prevent you from deleting the dlls in use!
- Copy all the dlls that are left to live right next to your main.exe
- Close your app, delete the partial dll folder, and restore your backup you made
- Profit!
So run main.exe in the command prompt over and over after each py2exe dist build. Add in lines to setup.py under includes to catch all the sub features of scipy you are using.
For example, I was getting the runtime error: Missing messagestream.
Googling "scipy messagestream" found this:
Then I added scipy._lib.messagestream
to the includes list and it didn't have that error any more!
Hope that helps.