By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,408 Members | 1,840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,408 IT Pros & Developers. It's quick & easy.

Single-file executables

P: n/a
Which of the Windows/Unix package builders for Python applications is
capable of creating single-file executables? I'm thinking of:

1. py2exe
2. Mcmillan Installer/PyInstaller
3. cxfreeze

The apps I've seen created by py2exe aren't single-file at all, the
install folder is full of files besides the main program. I'm looking
for a solution that stuffs all libraries, scripts, and the Python
runtime into one file.

--
Kevin Walzer
iReveal: File Search Tool
http://www.wordtech-software.com
Feb 11 '06 #1
Share this Question
Share on Google+
13 Replies


P: n/a
Kevin Walzer wrote:
The apps I've seen created by py2exe aren't single-file at all, the
install folder is full of files besides the main program. I'm looking
for a solution that stuffs all libraries, scripts, and the Python
runtime into one file.


For full control, and truly single-binary executables, I recommend
to use freeze itself. It takes a bit more work, but also gives better
results.

Regards,
Martin
Feb 12 '06 #2

P: n/a
Actually, py2exe (from version 0.6.1) onwards does create single file
exes without ANY additional dependencies.

Feb 12 '06 #3

P: n/a
Kevin Walzer wrote:
Which of the Windows/Unix package builders for Python applications is
capable of creating single-file executables? I'm thinking of:

1. py2exe
2. Mcmillan Installer/PyInstaller
3. cxfreeze

The apps I've seen created by py2exe aren't single-file at all, the
install folder is full of files besides the main program. I'm looking
for a solution that stuffs all libraries, scripts, and the Python
runtime into one file.


I use pyinstaller. Its easy and makes a single file, even if you have
compiled dependencies like pycrypto (I don't think freeze handles these
so well). If you want ease of installation for windows, check out Inno
Setup. It gives a single downloadable installer that helps get around
the "unknown publisher" problem, and system registry editing. In
summary: pyinstaller + inno setup.

James
Feb 12 '06 #4

P: n/a
Ravi Teja wrote:
Actually, py2exe (from version 0.6.1) onwards does create single file
exes without ANY additional dependencies.


They still require an external MSVCR71.DLL if made with Python 2.4. PyInstaller
1.1 (to be released today) does not have this problem.
--
Giovanni Bajo
Feb 12 '06 #5

P: n/a
Giovanni Bajo wrote:
Ravi Teja wrote:
Actually, py2exe (from version 0.6.1) onwards does create single file
exes without ANY additional dependencies.


They still require an external MSVCR71.DLL if made with Python 2.4. PyInstaller
1.1 (to be released today) does not have this problem.


Can you describe how they get around that issue? As far as I know, the
reason py2exe requires the external DLL is that the licensing of that
file does not permit completely free redistribution. Does PyInstaller
actually bundle it, or does it include an interpreter without any
dependency on that file?

-Peter

Feb 12 '06 #6

P: n/a
As Peter later pointed out, that is a licencing issue rather than a
tool issue. After browsing through the PyInstaller documentation, I
came across a curious snippet.

"On Windows, this provides support for doing in-process COM servers. It
is not generalized. However, embedders can follow the same model to
build a special purpose DLL so the Python support in their app is
hidden. You will need to write your own dll, but thanks to Allan Green
for refactoring the C code and making that a managable task."

I am assuming that this means it makes it easy to expose my Python code
as a plain dll. Just what I was looking for. I don't see any more
elaboration on this. Anyone tried this?

Feb 12 '06 #7

P: n/a
Martin v. Lwis wrote:
Kevin Walzer wrote:
The apps I've seen created by py2exe aren't single-file at all, the
install folder is full of files besides the main program. I'm
looking for a solution that stuffs all libraries, scripts, and the
Python runtime into one file.

Usually the bundle=1 option in py2exe can create a single file exe, but it also
allows to have a separate shared library.zip file, which is useful if you need more than
one exe-file. With python 2.4, MSVCR71.dll is still required and not bundled. There are
technical reasons ('booting' the exe) and maybe legal reasons for that.

For full control, and truly single-binary executables, I recommend to
use freeze itself. It takes a bit more work, but also gives better
results.

I wonder if anyone is actually using freeze on Windows, with scripts that use,
say, pywin32 and wxPython.

I've said it before, and say it again: Creating real single-file exes or dlls
was a non-goal for py2exe. The goal was to be able to create in-process COM
servers which provide a python interpreter that is totally isolated from possible
other interpreters running in the same process.

py2exe simulates a statically linked python interpreter together with statically
linked extension modules. So, it is very similar to what freeze creates.

Thomas

Feb 12 '06 #8

P: n/a
Thomas Heller wrote:
I wonder if anyone is actually using freeze on Windows, with scripts
that use, say, pywin32 and wxPython.


Interesting question. I've never done so myself (only on Linux and
Solaris), and given the relatively small interest in having a static
Python library on Windows, I guess the answer is no (or: everybody
doing that has managed to deal with the build process themselves).

I would probably go for a mingw static build if I had to attempt this.

Regards,
Martin
Feb 12 '06 #9

P: n/a
Thomas Heller wrote:
I wonder if anyone is actually using freeze on Windows, with scripts
that use, say, pywin32 and wxPython.


Interesting question. I've never done so myself (only on Linux and
Solaris), and given the relatively small interest in having a static
Python library on Windows, I guess the answer is no (or: everybody
doing that has managed to deal with the build process themselves).

I would probably go for a mingw static build if I had to attempt this.

Regards,
Martin
Feb 12 '06 #10

P: n/a
In article <ma***************************************@python. org>,
Thomas Heller <th*****@python.net> wrote:
Feb 13 '06 #11

P: n/a
Cameron Laird wrote:
In article <ma***************************************@python. org>,
Thomas Heller <th*****@python.net> wrote:
.
.
.
Usually the bundle=1 option in py2exe can create a single file exe, but it also
allows to have a separate shared library.zip file, which is useful if
you need more than
one exe-file. With python 2.4, MSVCR71.dll is still required and not

.
.
.
For some of our projects, we provide a single executable, which
takes a command-line argument (or, rarely, environment variable)
to tell the executable whether to come up as server or client,
or GUI or command-line version, or ... The result is that, even
for an architecturally-sophisticated development, the end-user
experiences a unitary delivery; he has just one file to install,
remove, archive, ...


Ok, so you're down to about 0.2 files per application ;-)

Thomas

Feb 13 '06 #12

P: n/a
Kevin Walzer wrote:
Which of the Windows/Unix package builders for Python applications is
capable of creating single-file executables? I'm thinking of:

1. py2exe
2. Mcmillan Installer/PyInstaller
3. cxfreeze

The apps I've seen created by py2exe aren't single-file at all, the
install folder is full of files besides the main program. I'm looking
for a solution that stuffs all libraries, scripts, and the Python
runtime into one file.


I use py2exe and Inno Installer and get to a single file installation
that way. Inno creates setup.exe as a single file. That file may
actually expand into several files upon installation (which is
typical as you want readme.txt, history.txt, other documentation,
maybe example .ini file, etc.). IMHO the fact that py2exe doesn't
create a single exe is a non-problem. What other Windows app when
installed only installs <progname>.exe and NO OTHER FILES. Inno
solves the problem of only having a single .exe to DISTRIBUTE
which I think is the real goal. Inno also lets you automate the
creation of desktop/quicklaunch/startbutton icons, insertion of
items into the registry, and a whole host of other "stuff" that
normally must be done to complete a proper installation. With some
plug-ins, you can even have it get updates from a website (I have
not tested this, but I've read about it).

If you want to "obscure" your programs use the bundle option and
py2exe imbeds the .ZIP file inside the .EXE file (making it
somewhat harder to hack).

-Larry Bates
Feb 13 '06 #13

P: n/a
Larry Bates wrote:
Kevin Walzer wrote:
Which of the Windows/Unix package builders for Python applications is
capable of creating single-file executables? I'm thinking of:

1. py2exe
2. Mcmillan Installer/PyInstaller
3. cxfreeze

The apps I've seen created by py2exe aren't single-file at all, the
install folder is full of files besides the main program. I'm looking
for a solution that stuffs all libraries, scripts, and the Python
runtime into one file.


I use py2exe and Inno Installer and get to a single file installation
that way. Inno creates setup.exe as a single file. That file may
actually expand into several files upon installation (which is
typical as you want readme.txt, history.txt, other documentation,
maybe example .ini file, etc.). IMHO the fact that py2exe doesn't
create a single exe is a non-problem. What other Windows app when
installed only installs <progname>.exe and NO OTHER FILES. Inno
solves the problem of only having a single .exe to DISTRIBUTE
which I think is the real goal. Inno also lets you automate the
creation of desktop/quicklaunch/startbutton icons, insertion of
items into the registry, and a whole host of other "stuff" that
normally must be done to complete a proper installation. With some
plug-ins, you can even have it get updates from a website (I have
not tested this, but I've read about it).

If you want to "obscure" your programs use the bundle option and
py2exe imbeds the .ZIP file inside the .EXE file (making it
somewhat harder to hack).

-Larry Bates


It's not so much for "obscurity" as simplicity.

Tcl/Tk allows you to pack everything into a single file: it's called a
"starpack." You can use an installer, but it's not necessary--the file
can be uninstalled by moving it to the recycle bin.

On Mac OS X, applications are typically deployed as a "bundle"--the .app
extension is actually a directory that looks like a single file. All the
libraries, etc. can be placed inside.

The install directories that are created by py2exe, at least the ones
I've seen in the past, seem messy by comparison. As I understand it, the
latest version allows you to do "one-file-deployment," which is what I'm
looking for. PyInstaller also does this, from what I'm told.

So, I'm interested in that type of functionality.

--
Kevin Walzer
iReveal: File Search Tool
http://www.wordtech-software.com
Feb 13 '06 #14

This discussion thread is closed

Replies have been disabled for this discussion.