ronaldoussoren / py2app

py2app is a Python setuptools command which will allow you to make standalone Mac OS X application bundles and plugins from Python scripts.
Other
340 stars 36 forks source link

Permission denied error while running setup.py py2app #510

Open fluffy-critter opened 10 months ago

fluffy-critter commented 10 months ago

Hi, I'm trying to set up a build on an app using wxPython. My Python installation is managed by Homebrew, and I'm using poetry to manage my development environment.

When I run poetry run python3 setup.py py2app I get a lot of build output, which ends with the error:

error: [Errno 13] Permission denied: '/Users/fluffy/projects/bandcrash/dist/Bandcrash.app/Contents/Resources/lib/python3.11/lib-dynload/../../../../../../../../../../opt'

If I try to run the resulting .app file I get an error dialog which reads, "A Python runtime not could be located. You may need to install a framework build of Python, or edit the PyRuntimeLocations array in this application's Info.plist file." From the error it seems that it's attempting to pull in the Python3 installation (in /opt/homebrew) using some relative paths.

My setup.py is as follows, adapted from the guide at https://py2app.readthedocs.io/en/latest/examples.html:

import sys
import os.path
from setuptools import setup

mainscript=os.path.join('bandcrash','gui.py')

if sys.platform == 'darwin':
     extra_options = dict(
         setup_requires=['py2app'],
         app=[mainscript],
         options=dict(py2app=dict(argv_emulation=True)),
     )
elif sys.platform == 'win32':
     extra_options = dict(
         setup_requires=['py2exe'],
         app=[mainscript],
     )
else:
     extra_options = dict(
         scripts=[mainscript],
     )

setup(
    packages=["bandcrash"],
    name="Bandcrash",
    **extra_options
)
fluffy-critter commented 10 months ago

Just as a check I tried building the superdoodle app from the py2app examples, and had the same error, with both Python 3.11 and 3.10.