Single-file executables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Walzer

    #1

    Single-file executables

    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

  • Martin v. Löwis

    #2
    Re: Single-file executables

    Kevin Walzer wrote:[color=blue]
    > 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.[/color]

    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

    Comment

    • Ravi Teja

      #3
      Re: Single-file executables

      Actually, py2exe (from version 0.6.1) onwards does create single file
      exes without ANY additional dependencies.

      Comment

      • James Stroud

        #4
        Re: Single-file executables

        Kevin Walzer wrote:[color=blue]
        > 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.
        >[/color]

        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

        Comment

        • Giovanni Bajo

          #5
          Re: Single-file executables

          Ravi Teja wrote:
          [color=blue]
          > Actually, py2exe (from version 0.6.1) onwards does create single file
          > exes without ANY additional dependencies.[/color]

          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


          Comment

          • Peter Hansen

            #6
            Re: Single-file executables

            Giovanni Bajo wrote:[color=blue]
            > Ravi Teja wrote:[color=green]
            >>Actually, py2exe (from version 0.6.1) onwards does create single file
            >>exes without ANY additional dependencies.[/color]
            >
            > 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.[/color]

            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

            Comment

            • Ravi Teja

              #7
              Re: Single-file executables

              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?

              Comment

              • Thomas Heller

                #8
                Re: Single-file executables

                Martin v. Löwis wrote:[color=blue]
                > Kevin Walzer wrote:[color=green]
                >> 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.[/color][/color]

                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.

                [color=blue]
                > 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.[/color]


                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

                Comment

                • Martin v. Löwis

                  #9
                  Re: Single-file executables

                  Thomas Heller wrote:[color=blue]
                  > I wonder if anyone is actually using freeze on Windows, with scripts
                  > that use, say, pywin32 and wxPython.[/color]

                  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

                  Comment

                  • Martin v. Löwis

                    #10
                    Re: Single-file executables

                    Thomas Heller wrote:[color=blue]
                    > I wonder if anyone is actually using freeze on Windows, with scripts
                    > that use, say, pywin32 and wxPython.[/color]

                    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

                    Comment

                    • Cameron Laird

                      #11
                      Arcane deployment considerations (was: Single-file executables)

                      In article <mailman.1794.1 139778796.27775 .python-list@python.org >,
                      Thomas Heller <theller@python .net> wrote:

                      Comment

                      • Thomas Heller

                        #12
                        Re: Arcane deployment considerations

                        Cameron Laird wrote:[color=blue]
                        > In article <mailman.1794.1 139778796.27775 .python-list@python.org >,
                        > Thomas Heller <theller@python .net> wrote:
                        > .
                        > .
                        > .[color=green]
                        >> 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[/color]
                        > .
                        > .
                        > .
                        > 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, ...[/color]

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

                        Thomas

                        Comment

                        • Larry Bates

                          #13
                          Re: Single-file executables

                          Kevin Walzer wrote:[color=blue]
                          > 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.
                          >[/color]

                          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>.ex e 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

                          Comment

                          • Kevin Walzer

                            #14
                            Re: Single-file executables

                            Larry Bates wrote:[color=blue]
                            > Kevin Walzer wrote:[color=green]
                            >> 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.
                            >>[/color]
                            >
                            > 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>.ex e 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[/color]

                            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

                            Comment

                            Working...