Create executable with Python, which use QT and different versions of python - python

I am planning to make a self contained app on OSX, which use a QT/PYQT UI with Python3, and also code using Python2 (because the libraries I use are not available on Python3 yet).
I am using Pyinstaller; which create apps that works fine on my machine, but when I try the same app on a different machine I get crashes or errors.
I was under the impression that Pyinstaller does generate a self contained app, but it seems that I still need to install QT on the computers that will run this app? Is there a better way to generate self contained apps, that would work in my scenario?

Deploying pure python apps with Pyinstaller is straight forward but it comes tricky especially with a framework like pyqt. The best results i got so far was using cx_freeze which makes sure that all the dependencies are packaged correctly.
Here is an extensive walkthrough:
https://www.smallsurething.com/a-really-simple-guide-to-packaging-your-pyqt-application-with-cx_freeze/

Related

python and package installment while application is installed

I have done some image processing works using python 3.5, opencv, scikit modules etc for an unreal engine game application.
I have manually installed python and other modules using pip in my windows system.
Now when a user installs the application, i want python and those modules to be installed auto with the application's installment.
I saw pyinstaller which turns py file to application file but unfortunately could not understand how to work it of what i want.
Thank you for any piece of advice.
First, let me say Python packaging has improved a lot over the years, but is still considered very hard compared to other languages like e.g. golang.
Generally, I see two ways how to bring your applications to your user.
Either make a Python package or create an installable package for an operation system.
A Python package means, you could upload it somewhere (e.g. PyPi) and your users could pip install your_package. This involves a lot of work. A good starting point would be:
https://packaging.python.org/tutorials/packaging-projects/
The second option is to create an installer or e.g. Windows.
There are several tools out there, like the mentioned pyinstaller, more on this page: https://docs.python-guide.org/shipping/freezing/
Also, there is a new option called PyOxidizer ( https://pyoxidizer.readthedocs.io/en/stable/overview.html ).
At work we used cx_Freeze - which worked ok.
Unfortunately, there is no easy way. Have a look at several options, and then decide for one.

GUI apps in python 3.4

I've been looking for a GUI system for python applications for a while and have found these 2, Tkinter and PyQT. The issue I'm having is that I cannot work out whether PyQT requires the end user to have QT installed and whether Tkinter will work properly on another computer as I have read a lot about it being touchy when it comes to Tk/Tcl version.
What I'm trying to do with it is create an application for a friend so that he can keep track of his beehives more easily and I didn't think that having it in a terminal would be the way to go. Thanks.
I have worked with both in the past and from my observations:
whether PyQT requires the end user to have QT installed
Yes, it does. However you can bundle your app along with the dependencies (Python + QT) using tools like PyInstaller. You will get a single package that you can distribute to your users. They can run it without installing anything.
You can also create custom installers which install Python and QT on the target systems for you. Then the users can just run the Python script.
whether Tkinter will properly on another computer as I have read a lot
about it being touchy when it comes to Tk/Tcl version
I have never faced any issues with it since I mostly deployed my Tkinter apps to Windows and I installed the same version of Python on the target systems that I used to develop. However, there might be version conflicts on other platforms (eg. Linux/OS X).
What I'm tying to do with it is create an application for a friend so
that he can keep track of his beehives more easily
Have you thought about web based GUI? A python script running a webserver on a local machine? You can use the "webbrowser" module to open up a browser to load the url when the script is run.
There is another alternative: Kivy.

Distribute a Python without additional libraries and interpreter

I have a simple application. When I compile it in .NET I can just distribute the .dll or .exe without having an installer.
But how do I do this with Python? For example we have machine without the Python interpreter or with the Python interpreter but without 3rd party libraries.
You have a couple of options:
Provide an installer for Python. Once they've installed Python, they're good. They've already had the .NET runtime installed - this is really no different (except Microsoft didn't embed Python into their OS)
Use Portable Python. You can actually build your own version (though I've never done it so I have no clue how hard it would be).
Use cxFreeze or py2exe. This packages the python interpreter up along with your source so it looks like just one .exe but actually contains more
Use IronPython this way or distribute it in some other fashion.
If you don't require access to the local machine, use Flask or some other Python framework/microframework and host the app on the web using something like Heroku's free tier.
There might be some other options as well, but those are probably the most common.
Use Py2Exe. It makes a .exe file out of your script, including the interpreter and required libraries. It's going to be bigger than your script though because of the interpreter.

Is there a skeleton project for a graphical cross-platform Python application?

I found that making a Python application work across all three platforms with, say, PySide is hard enough work as it is. Surely there's a project that provides an example codebase where this all works (even packaging the application and deploying it as well)
You could use PyInstaller. The development version works with OSX and the older versions work with all linux distributions i have tried (ubuntu/debian, opensuse,...)
Just have a look at it, works fine for me www.pyinstaller.org

Making Windows executables from Django applications

I am trying to make a Django website be a simple Windows executable. I've been told that py2exe does not work correctly, both due to Django using __import__, and to its attempting to dispatch manage.py in some obscure way. Is that the case? If so, is there an alternative tool that works better, or is there a way to work around the py2exe issues?
You can try Pyinstaller.
PyInstaller trunk has been succesfully used to build Django applications. It has builtin support for many Django magic, but requires a careful setup (have a look at the dedicated wiki page).

Categories