Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

py2app packaging #10

Open
johnty opened this issue Feb 15, 2019 · 6 comments
Open

py2app packaging #10

johnty opened this issue Feb 15, 2019 · 6 comments

Comments

@johnty
Copy link
Contributor

johnty commented Feb 15, 2019

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.

@radarsat1
Copy link
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.

@johnty
Copy link
Contributor Author

johnty commented Feb 23, 2019

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

@ChristianFrisson
Copy link
Contributor

ChristianFrisson commented May 26, 2020

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

@radarsat1
Copy link
Member

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

@ChristianFrisson
Copy link
Contributor

ChristianFrisson commented May 26, 2020

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"?

@malloch
Copy link
Member

malloch commented May 27, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants