Skip to content

py2app packaging #10

Description

@johnty

I've been experimenting with the packaging process, and have ran into the following:

  • seems like an older version (0.16) of py2app is needed
  • how large the package you end up with, depends heavily on the python environment regardless of what libraries you're using for the application itself. as such i think the best way is to use a clean virtualenv. (this could also explain why in the past we generated binaries of different sizes... i just tried with the anaconda installed version of python and made a 400MB file ;)
  • however, there seem to be some missing libraries depending on what configuration you start with. currently for some reason libffi is not being included automatically in my particular setup.

the basic process to bundle the package is to just run the following after py2app is installed:

python setup.py py2app

also note that currently setup.py doesn't include the html folder in data_files, so that needs to be added to the list for the base html file to be included in the package it seems.

Activity

  1. radarsat1 commented on Feb 18, 2019

    @radarsat1
    Member

    On dimple I have been experimenting with using Travis to package builds. It works well, you can generate a "build artifact" and then post it to the "gh-pages" branch which makes it show up on github.io. That way it would be done in a clean environment automatically with all reproducibility instructions in one place.

  2. johnty commented on Feb 23, 2019

    @johnty
    ContributorAuthor

    Thanks Steve! I think getting it on Travis would be great as a way to automate the builds on a clean system.

    In the mean time, I've figured out that we can explicitly pass the following argument to py2app:

    python setup.py py2app --frameworks /opt/local/lib/libffi.6.dylib

    This is somewhat strange still, since on systems where it initially fails, libffi is usually present but for some reason the embedded python runtime from the built pacakge is not looking there. I expect there's a bad configuration in my setup somewhere... On systems where the package doesn't run, I can simply copy over the local version of libffi alongside the embedded dylibs, and everything will work fine. For now the above explicit inclusion works, except I also found that in my particular case a system before High Sierra (10.12) does not like that version of libffi...

  3. ChristianFrisson commented on May 26, 2020

    @ChristianFrisson
    Contributor

    Hi libmapper/webmapper team,

    On Ubuntu / Pop!_OS 20.04, pip3 install py2app then python3 setup.py py2app fails with:

    copying file build/bdist.linux-x86_64/python3.8-standalone/app/python38.zip -> dist/WebMapper.app/Contents/Resources/lib
    Traceback (most recent call last):
      File "setup.py", line 17, in <module>
        setup(name='WebMapper',
      File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "~/.local/lib/python3.8/site-packages/py2app/build_app.py", line 907, in run
        self._run()
      File "~/.local/lib/python3.8/site-packages/py2app/build_app.py", line 1125, in _run
        self.run_normal()
      File "~/.local/lib/python3.8/site-packages/py2app/build_app.py", line 1238, in run_normal
        self.create_binaries(py_files, pkgdirs, extensions, loader_files)
      File "~/.local/lib/python3.8/site-packages/py2app/build_app.py", line 1545, in create_binaries
        dst = self.build_executable(
      File "~/.local/lib/python3.8/site-packages/py2app/build_app.py", line 2315, in build_executable
        self.copy_file(zlib.__file__, os.path.dirname(arcdir))
    AttributeError: module 'zlib' has no attribute '__file__'
    

    From the first line I assume packaging has been developed for macOS only?

    Kind regards,
    Christian

  4. radarsat1 commented on May 26, 2020

    @radarsat1
    Member

    It's been a while, but I thought the Windows equivalent of py2app was py2exe. Probably things have changed.

  5. ChristianFrisson commented on May 26, 2020

    @ChristianFrisson
    Contributor

    Answer from the py2app website: py2app - Create standalone Mac OS X applications with Python.

    Maybe the libmapper README could state "To build standalone application on macOS"?

  6. malloch commented on May 27, 2020

    @malloch
    Member
  7. ChristianFrisson commented on Jul 17, 2026

    @ChristianFrisson
    Contributor

    py2app should be deprecated in favour of pyinstaller, via #48 and earlier contributions on https://github.com/libmapper/webmapper/commits/main/webmapper.spec by @bboettcher3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions