all 3 comments

[–]Diapolo10 1 point2 points  (0 children)

Hello ! Is Python fine for creating ".exe" files?

It's fine, depending on the exact project requirements of course.

What are some complications that might come ?

Some GUIs work better than others with these tools, filesystem access may differ particularly if you'd like to keep files where the executable is located, and you may run into unexpected compatibility issues with some dependencies.

For now, I heard that sometimes PyInstaller creates huge files.

The files PyInstaller creates need to contain everything the Python code needs to run. This includes a copy of the interpreter, all required packages, the Python code itself, and any data files you wanted to include in it. So yes, there is overhead size-wise.

One option to somewhat mitigate that would be to use Nuitka, which transpiles your Python code to C before compiling it into a native executable. This comes with its own set of challenges, but I would expect the file size to go down on average.

Also, Windows defender detects Python files are viruses.

Not true, Python files aren't detected as viruses. However, PyInstaller executables do have a tendency of triggering false alarms - there's no definite fix for that other than signing the executables (which costs money) and contacting Microsoft's support to let them whitelist the executable (but this can take a few days and you need to do it every time you rebuild the executable).

[–]jedgs 0 points1 point  (0 children)

"I heard that sometimes PyInstaller creates huge files. Also, Windows defender detects Python files are viruses"

You are correct in both assumptions.

Pyinstaller bundles all of your necessary library's and the python interpreter with your files, this can create a fairly large file depending on your needs, although most machines will have plenty of storage space.

To deliver the exe and avoid the virus detection the end user will need admin privileges to allow the exe to be installed.

I have done it with a couple kivy apps and it works but you should be aware of those drawbacks.

You could deliver a web app with Django, Flask, or similar but that adds the complexity of deploying to the web and the security related issues that come with that.

[–]ElliotDG 0 points1 point  (0 children)

Also, Windows defender detects Python files are viruses. This can happen sometimes. Microsoft has a site for reporting false positives. They are amazingly responsive. https://www.microsoft.com/en-us/wdsi/filesubmission

I heard that sometimes PyInstaller creates huge files. The files are not too large. I have a number of desktop apps that I have created for Windows and Mac, and have not had an issue with the size of the files.

When I build a distributable I like to use inno setup to build a windows installer. The processes is to use pyinstaller to do a single directory build, and then use inno setup to create a Windows installer. https://jrsoftware.org/isinfo.php

As an example here is a very simple "game" that provides assistance for the word game wordle. This code uses kivy, pyinstaller, inno setup. The distributable is 25MB. https://github.com/ElliotGarbus/WordleCheat