I was wondering if anyone has any success in creating a stand alone executable using pyinstaller with a script that has enthought imports. I have been trying to do this for a couple of days now, however I keep getting an import error. Through some digging around I believe that I might need to add some hidden import and create my own hooks. However I have not heard of anyone having any success with this, so I thought I would ask here and see if anyone might have some experience with this situation.
I had been trying to build a stand alone exe of my python app which uses matplotlib (one of the components of enthought) and was having lots of trouble getting it to work. Finally found a bug post (http://www.pyinstaller.org/ticket/651) on pyinstaller site that told me that it was a bug in pyinstaller. I followed the reference in that post to download the fixed version of pyinstaller at ​https://github.com/pyinstaller/pyinstaller/pull/61
Now my build to stand alone exe works fine. I bet you were experiencing the same problem as me. see... Building python pylab/matplotlib exe using pyinstaller
Related
I tried to create an executable file in Windows from a kivy project with PyInstaller, and even though it appears to have been successfully created, when I try to run it, I get this
What could cause this? I'm relatively new to kivy, and any help will be much appreciated
well, I actually figured it out myself. Though I don't think that my solution is in any way elegant and it might cause some other problems in the future, but i just edited the pyi_rth_pkgutil.py from PyInstaller package directory (how it is now, how it used to be) and reran the pyinstaller package creation script. It just worked after that
Recently I have written a simple software in python and now I would like to share it with some people, but the problem is that they don't use python on their computer. Because of that an executable program could help me a lot and I tried to do it by using the package Pyinstaller with the following syntax:
pyinstaller --onefile -w program.py
After doing that three new folders was created and I found the executable file inside the dist folder but it doesn't work. When I clicked twice a error message showed up
Error message
Could anyone please tell why it happens and how I can work around this situation ? And also if you have another idea about how to convert .py to .exe besides using the Pyinstaller it would help me so much as well. I'm using python 3.8
Thanks
What error does it give you?
I haven't used Pyinstaller, but I've had success with auto-pye-to-exe as an alternative.
PyInstaller does not compile Python code into binary code. It just bundles your code into one installable exe file. So it does not improve the performance or code privacy.
Better option is to use CXFreeze or Nuitka. I personally prefer to use Nuitka because it worked in most cases where CXFreeze could not deal with.
Simply install Nuitka using pip or conda command. The documentation itself is quite good to start with.
I am trying to create a standalone exe from python code using nuitka. Its a rather sizable program with several libraries including for instance PyQt5.
I have created the exe using:python -m nuitka --standalone --follow-imports --enable-plugin=qt-plugins --enable-plugin=numpy --python-flag=no_site --mingw64 rs_main.py
I have also tried without the --mingw64 and --python-flag=no_site flags but they all give me the same error when I try to execute the resulting exe:
ImportError: LoadLibraryEx 'D:\... ...\rs_main.dist\PyQt5\QtWidgets.pyd' failed: The specified procedure could not be found.
I checked and the file does exist in the correct location.
The compiling itself gives me some warnings but no errors.
Online I found my problem here: https://github.com/Nuitka/Nuitka/issues/73 but to be honest I do not fully understand their journey towards the solution and as I think I understand it should be solved in my version of nuitka which is 0.6.6. On top of that I am running python 3.7.3 on a windows 10 machine.
Hopefully someone can explain me the solution in the referenced link or offer one of their own. thanks in advance.
So this is not really an answer to my question, but if anyone comes across this question, maybe my solution is good enough for them as well.
So although I know it does not do the same as Nuitka I was finally able to create a standalone exe using pyinstaller including some flags such as --hidden-imports and add the path to Qt but I found the feedback of pyinstaller to be rather understandable.
So maybe if you have the same problem as me, this might be a different approach for you as well.
Good evening, noble experts. I'm likely going to betray some of my ignorance again!
I've written a python script that creates a window in tkinter, and works the way I'd like it to so far as I can tell. What I'd like to do now is turn it into a standalone .exe that will, upon being double-clicked, generate said window for use.
I've installed pyinstaller, and put in the fateful commands to create the .exe from my humble .py
.../python pyinstaller.py -w -F examplename.py
and shiny new .exe was made and put into the /dist folder. The problem I seem to be encountering, is that running this application doesn't open up the tkinter window in the script, and I'm not sure why. Based on the tutorials I've seen online and my own limited understanding of the process, I suspect that it may have something to do with a SPEC file, which I have not yet fiddled with as I'm not 100% certain that is what's causing this issue.
I would greatly appreciate any insight into this, and if I've neglected key information that you need, I will try and fill that in asap. Thank you!
Edit: so it turns out that one of the modules that I was using in this, (scipy), has some known issues with pyinstaller. When I commented out the scipy stuff, it worked the way it was supposed to... minus the scipy of course. I'm going to have to spend some time figuring out/understanding the workaround for it.
I'm looking to find a way to bundle a python app into stand-alone executables so my windows and mac using friends can use it without installing ugly dependencies. Looking online I've found a few utilities to help do this, including py2exe for windows and py2app for mac, as well as PyInstaller, cx-freeze, and bbfreeze. What have ya'll used and what would you recommend?
I've been building a python app with PyQt and PyQwt for the past few weeks and have had the same problem. I found py2app completely impossible to use, I kept running into so many problems constantly that I gave up. A few days later found PyInstaller which is fantastic. It understands both PyQt and PyQwt out of the box - and does a very nice job in wrapping everything into an app bundle. Haven't tried building a Windows executable with it yet though.
I found a good article at arstechnica on how to use py2exe and py2app although it's a bit old (you can probably skip the python 2.5 stuff) http://arstechnica.com/open-source/guides/2009/03/how-to-deploying-pyqt-applications-on-windows-and-mac-os-x.ars/
I would highly recommend using PyInstaller. There are a couple of tricks though you need to do for OS X since the support is currently only preminary http://diotavelli.net/PyQtWiki/PyInstallerOnMacOSX
I use py2exe to create a windows executable. The documentation is somewhat messy, but once I pulled together a working setup.py to use as a template I haven't had any problems altering it to generate any given exe. I've usually been able to find helpful information though Google searches, like when I needed to bundle in pngs for the UI to use.