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

briefcase run fails after briefcase create when using stub app templates #1729

Closed
zhenzi0322 opened this issue Apr 12, 2024 · 9 comments · Fixed by #1781
Closed

briefcase run fails after briefcase create when using stub app templates #1729

zhenzi0322 opened this issue Apr 12, 2024 · 9 comments · Fixed by #1781
Labels
bug A crash or error in behavior. good first issue Is this your first time contributing? This could be a good place to start! macOS The issue relates to Apple macOS support. windows The issue relates to Microsoft Windows support.

Comments

@zhenzi0322
Copy link

zhenzi0322 commented Apr 12, 2024

Describe the bug

When running an app on macOS or Windows, briefcase run will fail if a build step hasn't been executed.

On Windows, the error manifests as:

SystemExit: stub: No module named stub

On macOS, it is

The application cannot be opened for an unexpected reason, error=Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x158e246f0 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}

Steps to reproduce

$ briefcase new -Q app_name=foobar
$ cd foobar
$ briefcase create
$ briefcase run

Expected behavior

App should start without error. The run should imply the need for a build on the macOS/Windows app templates, but because the template and binary both exist, the need for a build isn't detected.

Screenshots

No response

Environment

  • Operating System: macOS, Windows
  • Python version: All
  • Software versions:
    • Briefcase: 0.3.17+

Logs

Traceback (most recent call last):
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\runpy.py", line 183, in _run_module_as_main
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\runpy.py", line 136, in _get_module_details
runpy._Error: No module named stub

During handling of the above exception, another exception occurred:

SystemExit: stub: No module named stub

---------------------------------------------------------------------------
Application quit abnormally (Exit code -1)!
stub: No module named stub

Unable to start app helloworld.

Additional context

The briefcase dev is normal, but the briefcase run is abnormal.

If you invoke briefcase run on a clean project, the app works.

If you invoke briefcase build before invoking briefcase run, the app works.

This only affects the app targets; the Xcode/VisualStudio templates do the right thing, because they require an explicit compilation step to create the binary.

@zhenzi0322 zhenzi0322 added the bug A crash or error in behavior. label Apr 12, 2024
@freakboy3742
Copy link
Member

freakboy3742 commented Apr 12, 2024

When reporting a bug, it's really important that you provide full reproduction instructions. You've given 3 commands - but haven't provided any details about the other inputs you've used (such as the name of your app), or the system where you're running (including operating system versions, briefcase versions, etc). The bug template asks for these details for reason - if you don't provide these details, it can be very difficult for us to diagnose the problem. I've updated your report to include some of the details you've omitted.


In this case, the problem is that the build step has been missed. A Windows app needs a build step to set some metadata on the binary. This should be picked up automatically, but it appears it isn't.

As a workaround, you can manually run:

briefcase build

This will only be needed on the initial build. Once the metadata has been set once, no additional builds will be required.

I believe the specific issue is caused because you did run briefcase create. If you invoke briefcase run without invoking briefcase create first, this triggers the create, which then causes a build to occur. However, if you invoke create, the template and the binary both exist, so Run assumes no build is required.

The same problem exists for both the macOS app and Windows app template, for the same reason - they're both stub apps that require additional modifications after the template is rolled out.

One fix would be to modify the app template so that the stub binary generated by the template is literally stub.exe; then the "build" step would be "rename stub.exe to .exe", which would be detected by a create/run sequence as an update that will be required on the first run, but not subsequent runs.

@freakboy3742 freakboy3742 changed the title SystemExit: stub: No module named stub briefcase run fails after briefcase create when using stub app templates Apr 12, 2024
@freakboy3742 freakboy3742 added good first issue Is this your first time contributing? This could be a good place to start! windows The issue relates to Microsoft Windows support. macOS The issue relates to Apple macOS support. labels Apr 12, 2024
@zhenzi0322
Copy link
Author

Thank you

@rmartin16
Copy link
Member

I believe this is the same issue as #807. Nonetheless, this should be resolved by #1714 since running the build step would no longer be dependent on the presence of the app binary.

@rbrecheisen
Copy link

On my Macbook Air (M1) I see that the stub file generated is called "Stub.0" while it looks for a file called "Stub" (which doesn't exist). On Windows I don't have this problem.

@freakboy3742
Copy link
Member

@rbrecheisen Can you clarify what you're doing to generate that behavior? As I've noted above, saying "I see behavior X" isn't very helpful unless we know all the details of how you're generating that behavior.

Is it exactly the instructions presented above? If I follow those instructions, I don't see the problem you're describing - and I'm not sure I see how you'd end up with a file named Stub.0 (unless Stub.0 was literally the formal name of your app).

If it's not exactly the instructions above, then it's very likely a different problem - so you should open a new ticket with the instructions of what you need to do in order to replicate the problem you're seeing. We can always close that ticket as a duplicate if it turns out the problem is the same as another one.

@rbrecheisen
Copy link

Yes of course, you're right. I just though perhaps my remark might trigger someone's memory. I have just built the helloworld app in a new virtual environment, went through all the steps, including briefcase package and it seems to work. So I have to go back to my original project and see what's different. The original app is definitely not called "Stub.0" so it has to be something else.

To give you an idea how I approach creating the helloworld app, I'm listing the full output below but, as I said, this works fine.

Given this helloworld app, I will start to copy in pieces of code from the original project and see at what point I start running into this stub error, if it persists.

Ralph

Platform:

Hardware Overview:

Model Name: MacBook Air
Model Identifier: MacBookAir10,1
Model Number: MGN63N/A
Chip: Apple M1
Total Number of Cores: 8 (4 performance and 4 efficiency)
Memory: 8 GB
System Firmware Version: 11881.61.3
OS Loader Version: 11881.61.3
Serial Number (system): FVFJJJSF1WFV
Hardware UUID: 02E225C2-6D82-58E0-873D-B05088F2831D
Provisioning UDID: 00008103-000D043C2ED3401E
Activation Lock Status: Enabled

Project output:

~/dev/tools$ mkdir testbriefcase
~/dev/tools$ cd testbriefcase
~/dev/tools/testbriefcase$ mkdir .venv
~/dev/tools/testbriefcase$ python -m venv ./.venv/testbriefcase
~/dev/tools/testbriefcase$ ls -lap
total 0
drwxr-xr-x 3 ralph staff 96 Feb 8 07:53 ./
drwxr-xr-x 20 ralph staff 640 Feb 8 07:53 ../
drwxr-xr-x 3 ralph staff 96 Feb 8 07:54 .venv/
~/dev/tools/testbriefcase$ source .venv/testbriefcase/bin/activate
(testbriefcase) /dev/tools/testbriefcase$ pip install briefcase
Collecting briefcase
Downloading briefcase-0.3.22-py3-none-any.whl (239 kB)
|████████████████████████████████| 239 kB 6.6 MB/s
Collecting tomli<3.0,>=2.0; python_version <= "3.10"
Downloading tomli-2.2.1-py3-none-any.whl (14 kB)
Collecting pip>=24.3
Downloading pip-25.0-py3-none-any.whl (1.8 MB)
|████████████████████████████████| 1.8 MB 21.2 MB/s
Collecting wheel>=0.37
Downloading wheel-0.45.1-py3-none-any.whl (72 kB)
|████████████████████████████████| 72 kB 3.6 MB/s
Collecting importlib_metadata>=4.4; python_version <= "3.9"
Downloading importlib_metadata-8.6.1-py3-none-any.whl (26 kB)
Collecting platformdirs<5.0,>=2.6
Downloading platformdirs-4.3.6-py3-none-any.whl (18 kB)
Collecting python-dateutil>=2.9.0.post0
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Collecting psutil<7.0,>=5.9
Downloading psutil-6.1.1-cp36-abi3-macosx_10_9_x86_64.whl (247 kB)
|████████████████████████████████| 247 kB 29.2 MB/s
Collecting dmgbuild<2.0,>=1.6.4; sys_platform == "darwin"
Downloading dmgbuild-1.6.4-py3-none-any.whl (34 kB)
Collecting httpx<1.0,>=0.20
Downloading httpx-0.28.1-py3-none-any.whl (73 kB)
|████████████████████████████████| 73 kB 10.3 MB/s
Collecting rich<14.0,>=12.6
Downloading rich-13.9.4-py3-none-any.whl (242 kB)
|████████████████████████████████| 242 kB 40.1 MB/s
Collecting tomli_w<2.0,>=1.0
Downloading tomli_w-1.2.0-py3-none-any.whl (6.7 kB)
Collecting cookiecutter<3.0,>=2.6.0
Downloading cookiecutter-2.6.0-py3-none-any.whl (39 kB)
Collecting setuptools>=60
Downloading setuptools-75.8.0-py3-none-any.whl (1.2 MB)
|████████████████████████████████| 1.2 MB 21.1 MB/s
Collecting build>=0.10
Downloading build-1.2.2.post1-py3-none-any.whl (22 kB)
Collecting packaging>=24.2
Downloading packaging-24.2-py3-none-any.whl (65 kB)
|████████████████████████████████| 65 kB 12.6 MB/s
Collecting GitPython<4.0,>=3.1
Downloading GitPython-3.1.44-py3-none-any.whl (207 kB)
|████████████████████████████████| 207 kB 18.3 MB/s
Collecting zipp>=3.20
Downloading zipp-3.21.0-py3-none-any.whl (9.6 kB)
Collecting six>=1.5
Downloading six-1.17.0-py2.py3-none-any.whl (11 kB)
Collecting ds_store>=1.1.0
Downloading ds_store-1.3.1-py3-none-any.whl (16 kB)
Collecting mac_alias>=2.0.1
Downloading mac_alias-2.2.2-py3-none-any.whl (21 kB)
Collecting anyio
Downloading anyio-4.8.0-py3-none-any.whl (96 kB)
|████████████████████████████████| 96 kB 18.0 MB/s
Collecting httpcore==1.*
Downloading httpcore-1.0.7-py3-none-any.whl (78 kB)
|████████████████████████████████| 78 kB 20.1 MB/s
Collecting idna
Using cached idna-3.10-py3-none-any.whl (70 kB)
Collecting certifi
Downloading certifi-2025.1.31-py3-none-any.whl (166 kB)
|████████████████████████████████| 166 kB 15.7 MB/s
Collecting pygments<3.0.0,>=2.13.0
Downloading pygments-2.19.1-py3-none-any.whl (1.2 MB)
|████████████████████████████████| 1.2 MB 86.8 MB/s
Collecting typing-extensions<5.0,>=4.0.0; python_version < "3.11"
Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Collecting markdown-it-py>=2.2.0
Using cached markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
Collecting requests>=2.23.0
Using cached requests-2.32.3-py3-none-any.whl (64 kB)
Collecting click<9.0.0,>=7.0
Downloading click-8.1.8-py3-none-any.whl (98 kB)
|████████████████████████████████| 98 kB 24.0 MB/s
Collecting Jinja2<4.0.0,>=2.7
Downloading jinja2-3.1.5-py3-none-any.whl (134 kB)
|████████████████████████████████| 134 kB 24.4 MB/s
Collecting arrow
Downloading arrow-1.3.0-py3-none-any.whl (66 kB)
|████████████████████████████████| 66 kB 20.8 MB/s
Collecting pyyaml>=5.3.1
Downloading PyYAML-6.0.2-cp39-cp39-macosx_10_9_x86_64.whl (184 kB)
|████████████████████████████████| 184 kB 21.9 MB/s
Collecting binaryornot>=0.4.4
Downloading binaryornot-0.4.4-py2.py3-none-any.whl (9.0 kB)
Collecting python-slugify>=4.0.0
Downloading python_slugify-8.0.4-py2.py3-none-any.whl (10 kB)
Collecting pyproject_hooks
Downloading pyproject_hooks-1.2.0-py3-none-any.whl (10 kB)
Collecting gitdb<5,>=4.0.1
Downloading gitdb-4.0.12-py3-none-any.whl (62 kB)
|████████████████████████████████| 62 kB 7.7 MB/s
Collecting sniffio>=1.1
Downloading sniffio-1.3.1-py3-none-any.whl (10 kB)
Collecting exceptiongroup>=1.0.2; python_version < "3.11"
Using cached exceptiongroup-1.2.2-py3-none-any.whl (16 kB)
Collecting h11<0.15,>=0.13
Using cached h11-0.14.0-py3-none-any.whl (58 kB)
Collecting mdurl
=0.1
Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Collecting urllib3<3,>=1.21.1
Downloading urllib3-2.3.0-py3-none-any.whl (128 kB)
|████████████████████████████████| 128 kB 16.5 MB/s
Collecting charset-normalizer<4,>=2
Downloading charset_normalizer-3.4.1-py3-none-any.whl (49 kB)
|████████████████████████████████| 49 kB 17.5 MB/s
Collecting MarkupSafe>=2.0
Downloading markupsafe-3.0.2.tar.gz (20 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Collecting types-python-dateutil>=2.8.10
Downloading types_python_dateutil-2.9.0.20241206-py3-none-any.whl (14 kB)
Collecting chardet>=3.0.2
Downloading chardet-5.2.0-py3-none-any.whl (199 kB)
|████████████████████████████████| 199 kB 15.1 MB/s
Collecting text-unidecode>=1.3
Using cached text_unidecode-1.3-py2.py3-none-any.whl (78 kB)
Collecting smmap<6,>=3.0.1
Downloading smmap-5.0.2-py3-none-any.whl (24 kB)
Building wheels for collected packages: MarkupSafe
Building wheel for MarkupSafe (PEP 517) ... done
Created wheel for MarkupSafe: filename=MarkupSafe-3.0.2-cp39-cp39-macosx_10_9_x86_64.whl size=11745 sha256=7bc34f9fdcebe2c7ba675996b44fbc850c2d1fded258463f312c52851357bef4
Stored in directory: /Users/ralph/Library/Caches/pip/wheels/ef/a2/e2/ed4645207ad3d4ad077e59cdce6f72af35a5ba9c4d052764b0
Successfully built MarkupSafe
Installing collected packages: tomli, pip, wheel, zipp, importlib-metadata, platformdirs, six, python-dateutil, psutil, mac-alias, ds-store, dmgbuild, sniffio, exceptiongroup, typing-extensions, idna, anyio, h11, certifi, httpcore, httpx, pygments, mdurl, markdown-it-py, rich, tomli-w, urllib3, charset-normalizer, requests, click, MarkupSafe, Jinja2, types-python-dateutil, arrow, pyyaml, chardet, binaryornot, text-unidecode, python-slugify, cookiecutter, setuptools, packaging, pyproject-hooks, build, smmap, gitdb, GitPython, briefcase
Attempting uninstall: pip
Found existing installation: pip 20.2.3
Uninstalling pip-20.2.3:
Successfully uninstalled pip-20.2.3
Attempting uninstall: setuptools
Found existing installation: setuptools 49.2.1
Uninstalling setuptools-49.2.1:
Successfully uninstalled setuptools-49.2.1
Successfully installed GitPython-3.1.44 Jinja2-3.1.5 MarkupSafe-3.0.2 anyio-4.8.0 arrow-1.3.0 binaryornot-0.4.4 briefcase-0.3.22 build-1.2.2.post1 certifi-2025.1.31 chardet-5.2.0 charset-normalizer-3.4.1 click-8.1.8 cookiecutter-2.6.0 dmgbuild-1.6.4 ds-store-1.3.1 exceptiongroup-1.2.2 gitdb-4.0.12 h11-0.14.0 httpcore-1.0.7 httpx-0.28.1 idna-3.10 importlib-metadata-8.6.1 mac-alias-2.2.2 markdown-it-py-3.0.0 mdurl-0.1.2 packaging-24.2 pip-25.0 platformdirs-4.3.6 psutil-6.1.1 pygments-2.19.1 pyproject-hooks-1.2.0 python-dateutil-2.9.0.post0 python-slugify-8.0.4 pyyaml-6.0.2 requests-2.32.3 rich-13.9.4 setuptools-75.8.0 six-1.17.0 smmap-5.0.2 sniffio-1.3.1 text-unidecode-1.3 tomli-2.2.1 tomli-w-1.2.0 types-python-dateutil-2.9.0.20241206 typing-extensions-4.12.2 urllib3-2.3.0 wheel-0.45.1 zipp-3.21.0
(testbriefcase) ~/dev/tools/testbriefcase$ briefcase create

Briefcase configuration error: Configuration file not found.

Did you run Briefcase in a project directory that contains 'pyproject.toml'?
(testbriefcase) ~/dev/tools/testbriefcase$ briefcase new

Let's build a new Briefcase app!

-- Formal Name ---------------------------------------------------------------

First, we need a formal name for your application.

This is the name that will be displayed to humans whenever the name of the
application is displayed. It can have spaces and punctuation if you like, and
any capitalization will be used as you type it.

Formal Name [Hello World]:

-- App Name ------------------------------------------------------------------

Next, we need a name that can serve as a machine-readable Python package name
for your application.

This name must be PEP508-compliant - that means the name may only contain
letters, numbers, hyphens and underscores; it can't contain spaces or
punctuation, and it can't start with a hyphen or underscore.

Based on your formal name, we suggest an app name of 'helloworld', but you can
use another name if you want.

App Name [helloworld]:

-- Bundle Identifier ---------------------------------------------------------

Now we need a bundle identifier for your application.

App stores need to protect against having multiple applications with the same
name; the bundle identifier is the namespace they use to identify applications
that come from you. The bundle identifier is usually the domain name of your
company or project, in reverse order.

For example, if you are writing an application for Example Corp, whose website
is example.com, your bundle would be 'com.example'. The bundle will be
combined with your application's machine readable name to form a complete
application identifier (e.g., com.example.helloworld).

Bundle Identifier [com.example]:

-- Project Name --------------------------------------------------------------

Briefcase can manage projects that contain multiple applications, so we need a
Project name.

If you're only planning to have one application in this project, you can use
the formal name as the project name.

Project Name [Hello World]:

-- Description ---------------------------------------------------------------

Now, we need a one line description for your application.

Description [My first application]:

-- Author --------------------------------------------------------------------

Who do you want to be credited as the author of this application?

This could be your own name, or the name of your company you work for.

Author [Jane Developer]:

-- Author's Email ------------------------------------------------------------

What email address should people use to contact the developers of this
application?

This might be your own email address, or a generic contact address you set up
specifically for this application.

Author's Email [jane@example.com]:

-- Application URL -----------------------------------------------------------

What is the website URL for this application?

If you don't have a website set up yet, you can put in a dummy URL.

Application URL [https://example.com/helloworld]:

-- Project License -----------------------------------------------------------

What license do you want to use for this project's code?

  1. BSD license
  2. MIT license
  3. Apache Software License
  4. GNU General Public License v2 (GPLv2)
  5. GNU General Public License v2 or later (GPLv2+)
  6. GNU General Public License v3 (GPLv3)
  7. GNU General Public License v3 or later (GPLv3+)
  8. Proprietary
  9. Other

Project License [1]:

-- GUI Framework -------------------------------------------------------------

What GUI toolkit do you want to use for this project?

Additional GUI bootstraps are available from the community.

Check them out at https://beeware.org/bee/briefcase-bootstraps

  1. Toga
  2. PySide6 (does not support iOS/Android/Web deployment)
  3. Pygame (does not support iOS/Android/Web deployment)
  4. Console (does not support iOS/Android/Web deployment)
  5. None

GUI Framework [1]: 2


[helloworld] Generating a new application 'Hello World'
Using app template: https://github.com/beeware/briefcase-template, branch v0.3.22
Using existing template (sha 3ade531c7a5a656629a87786305e2d4286d50f94, updated Mon Feb 3 08:35:51 2025)

[helloworld] Generated new application 'Hello World'

To run your application, type:

$ cd helloworld
$ briefcase dev

(testbriefcase) ~/dev/tools/testbriefcase$ cd helloworld
(testbriefcase) ~/dev/tools/testbriefcase/helloworld$ briefcase dev

[helloworld] Installing requirements...
Collecting PySide6-Essentials~=6.7
Downloading PySide6_Essentials-6.8.2.1-cp39-abi3-macosx_12_0_universal2.whl.metadata (3.7 kB)
Collecting std-nslog~=1.0.3
Using cached std_nslog-1.0.3-py3-none-any.whl.metadata (3.6 kB)
Collecting pytest
Using cached pytest-8.3.4-py3-none-any.whl.metadata (7.5 kB)
Collecting shiboken6==6.8.2.1 (from PySide6-Essentials~=6.7)
Downloading shiboken6-6.8.2.1-cp39-abi3-macosx_12_0_universal2.whl.metadata (2.5 kB)
Requirement already satisfied: exceptiongroup>=1.0.0rc8 in /Users/ralph/dev/tools/testbriefcase/.venv/testbriefcase/lib/python3.9/site-packages (from pytest) (1.2.2)
Collecting iniconfig (from pytest)
Using cached iniconfig-2.0.0-py3-none-any.whl.metadata (2.6 kB)
Requirement already satisfied: packaging in /Users/ralph/dev/tools/testbriefcase/.venv/testbriefcase/lib/python3.9/site-packages (from pytest) (24.2)
Collecting pluggy<2,>=1.5 (from pytest)
Using cached pluggy-1.5.0-py3-none-any.whl.metadata (4.8 kB)
Requirement already satisfied: tomli>=1 in /Users/ralph/dev/tools/testbriefcase/.venv/testbriefcase/lib/python3.9/site-packages (from pytest) (2.2.1)
Downloading PySide6_Essentials-6.8.2.1-cp39-abi3-macosx_12_0_universal2.whl (134.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 134.9/134.9 MB 12.6 MB/s eta 0:00:00
Downloading shiboken6-6.8.2.1-cp39-abi3-macosx_12_0_universal2.whl (401 kB)
Using cached std_nslog-1.0.3-py3-none-any.whl (4.8 kB)
Using cached pytest-8.3.4-py3-none-any.whl (343 kB)
Using cached pluggy-1.5.0-py3-none-any.whl (20 kB)
Using cached iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Installing collected packages: std-nslog, shiboken6, pluggy, iniconfig, pytest, PySide6-Essentials
Successfully installed PySide6-Essentials-6.8.2.1 iniconfig-2.0.0 pluggy-1.5.0 pytest-8.3.4 shiboken6-6.8.2.1 std-nslog-1.0.3
Installing dev requirements... done

[helloworld] Starting in dev mode...

2025-02-08 08:00:28.702 Python[21676:3126458] +[IMKClient subclass]: chose IMKClient_Modern
2025-02-08 08:00:28.703 Python[21676:3126458] +[IMKInputSession subclass]: chose IMKInputSession_Modern
(testbriefcase) ~/dev/tools/testbriefcase/helloworld$ briefcase create

[helloworld] Generating application template...
Using app template: https://github.com/beeware/briefcase-macOS-app-template.git, branch v0.3.22
Using existing template (sha e8082ea4d3310d7605e12f4ab1fa7ff7b637b974, updated Thu Jan 23 22:43:48 2025)

[helloworld] Installing support package...
Using support package https://briefcase-support.s3.amazonaws.com/python/3.9/macOS/Python-3.9-macOS-support.b15.tar.gz
Downloading Python-3.9-macOS-support.b15.tar.gz...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 00:04
Unpacking support package... done
Copying standard library into app bundle... done

[helloworld] Installing stub binary...
Using stub binary https://briefcase-support.s3.amazonaws.com/python/3.9/macOS/GUI-Stub-3.9-b10.zip
Downloading GUI-Stub-3.9-b10.zip...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 00:00
Installing stub binary... done

[helloworld] Installing application code...
Installing src/helloworld... done

[helloworld] Installing requirements...
Collecting PySide6-Essentials~=6.7
Using cached PySide6_Essentials-6.8.2.1-cp39-abi3-macosx_12_0_universal2.whl.metadata (3.7 kB)
Collecting std-nslog~=1.0.3
Using cached std_nslog-1.0.3-py3-none-any.whl.metadata (3.6 kB)
Collecting shiboken6==6.8.2.1 (from PySide6-Essentials~=6.7)
Using cached shiboken6-6.8.2.1-cp39-abi3-macosx_12_0_universal2.whl.metadata (2.5 kB)
Using cached PySide6_Essentials-6.8.2.1-cp39-abi3-macosx_12_0_universal2.whl (134.9 MB)
Using cached shiboken6-6.8.2.1-cp39-abi3-macosx_12_0_universal2.whl (401 kB)
Using cached std_nslog-1.0.3-py3-none-any.whl (4.8 kB)
Installing collected packages: std-nslog, shiboken6, PySide6-Essentials
Successfully installed PySide6-Essentials-6.8.2.1 shiboken6-6.8.2.1 std-nslog-1.0.3
Installing app requirements... done
All packages are pure Python, or universal.
No libraries require thinning.
Merging app_packages.x86_64... done
Merging app_packages.arm64... done
Merging libraries...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 00:05

[helloworld] Installing application resources...

[helloworld] Removing unneeded app content...
Removing unneeded app bundle content... done

[helloworld] Created build/helloworld/macos/app
(testbriefcase) ~/dev/tools/testbriefcase/helloworld$ briefcase build

[helloworld] Building App...
Renaming stub binary... done

[helloworld] Ad-hoc signing app...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 00:28

[helloworld] Built build/helloworld/macos/app/Hello World.app
(testbriefcase) ~/dev/tools/testbriefcase/helloworld$ briefcase run

[helloworld] Starting app...

(testbriefcase) ~/dev/tools/testbriefcase/helloworld$ briefcase package

[helloworld] Signing app...

-- Application Signing Identity ----------------------------------------------

Select application signing identity to use:

  1. Ad-hoc identity. The resulting package will run but cannot be re-distributed.

Application Signing Identity: 1

In future, you could specify this signing identity by using:

$ briefcase package macOS app --adhoc-sign ...

** WARNING: Signing with an ad-hoc identity **


This app is being signed with an ad-hoc identity. The resulting
app will run on this computer, but will not run on anyone else's
computer.

To generate an app that can be distributed to others, you must
obtain an application distribution certificate from Apple, and
select the developer identity associated with that certificate
when running 'briefcase package'.

Signing app with ad-hoc identity...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 00:27

[helloworld] Building DMG...
Building Hello World-0.0.1.dmg... done

[helloworld] Packaged dist/Hello World-0.0.1.dmg

@rbrecheisen
Copy link

Just to give a bit more output from my original project, see below. It's probably not enough for you to pinpoint the problem so I will be copying pieces of this code, like I said, into the previously mentioned helloworld app.

Ralph

~/dev/tools/MosamaticDesktop2.0$ cd mosamaticdesktop
~/dev/tools/MosamaticDesktop2.0/mosamaticdesktop$ ls -l
total 72
-rw-r--r-- 1 ralph staff 81 Feb 6 11:49 CHANGELOG
-rw-r--r-- 1 ralph staff 1494 Feb 6 11:49 LICENSE
-rw-r--r-- 1 ralph staff 489 Feb 6 11:49 README.rst
drwxr-xr-x 3 ralph staff 96 Jan 31 22:25 build
-rw-r--r-- 1 ralph staff 20480 Jan 31 23:42 db.sqlite3
drwxr-xr-x 3 ralph staff 96 Jan 31 23:02 dist
drwxr-xr-x 9 ralph staff 288 Feb 6 11:51 logs
-rw-r--r-- 1 ralph staff 2426 Feb 8 08:14 pyproject.toml
drwxr-xr-x 5 ralph staff 160 Feb 8 08:14 src
drwxr-xr-x 6 ralph staff 192 Feb 6 11:49 tests
~/dev/tools/MosamaticDesktop2.0/mosamaticdesktop$ briefcase update
zsh: command not found: briefcase
~/dev/tools/MosamaticDesktop2.0/mosamaticdesktop$ source ~/.venv/MosamaticDesktop2.0/bin/activate
(MosamaticDesktop2.0) ~/dev/tools/MosamaticDesktop2.0/mosamaticdesktop$ briefcase update

[mosamaticdesktop] Updating application code...
Installing src/mosamaticdesktop... done

[mosamaticdesktop] Removing unneeded app content...
Removing unneeded app bundle content... done

[mosamaticdesktop] Application updated.
(MosamaticDesktop2.0) ~/dev/tools/MosamaticDesktop2.0/mosamaticdesktop$ briefcase build

[mosamaticdesktop] Building App...

[mosamaticdesktop] Ad-hoc signing app...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 00:01

[mosamaticdesktop] Built build/mosamaticdesktop/macos/app/Mosamatic Desktop 2.0.app
(MosamaticDesktop2.0) ~/dev/tools/MosamaticDesktop2.0/mosamaticdesktop$ briefcase run

[mosamaticdesktop] Starting app...
The application cannot be opened for an unexpected reason, error=Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x600001b4c0f0 {Error Domain=NSPOSIXErrorDomain Code=111 "Unknown error: 111" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}

Unable to start app mosamaticdesktop.

Log saved to /Users/ralph/dev/tools/MosamaticDesktop2.0/mosamaticdesktop/logs/briefcase.2025_02_08-08_15_32.run.log

(MosamaticDesktop2.0) ~/dev/tools/MosamaticDesktop2.0/mosamaticdesktop$ briefcase create

Application 'mosamaticdesktop' already exists; overwrite [y/N]? y

[mosamaticdesktop] Removing old application bundle...

[mosamaticdesktop] Generating application template...
Using app template: https://github.com/beeware/briefcase-macOS-app-template.git, branch v0.3.21
Using existing template (sha e8082ea4d3310d7605e12f4ab1fa7ff7b637b974, updated Thu Jan 23 22:43:48 2025)

[mosamaticdesktop] Installing support package...
Using support package https://briefcase-support.s3.amazonaws.com/python/3.12/macOS/Python-3.12-macOS-support.b6.tar.gz
Python-3.12-macOS-support.b6.tar.gz already downloaded
Unpacking support package... done
Copying standard library into app bundle... done

[mosamaticdesktop] Installing stub binary...
Using stub binary https://briefcase-support.s3.amazonaws.com/python/3.12/macOS/GUI-Stub-3.12-b10.zip
GUI-Stub-3.12-b10.zip already downloaded
Installing stub binary... errored

Log saved to /Users/ralph/dev/tools/MosamaticDesktop2.0/mosamaticdesktop/logs/briefcase.2025_02_08-08_15_55.create.log

Traceback (most recent call last):
File "/Users/ralph/.venv/MosamaticDesktop2.0/bin/briefcase", line 8, in
sys.exit(main())
^^^^^^
File "/Users/ralph/.venv/MosamaticDesktop2.0/lib/python3.12/site-packages/briefcase/main.py", line 27, in main
command(**options)
File "/Users/ralph/.venv/MosamaticDesktop2.0/lib/python3.12/site-packages/briefcase/commands/create.py", line 989, in call
state = self.create_app(app, **full_options(state, options))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ralph/.venv/MosamaticDesktop2.0/lib/python3.12/site-packages/briefcase/commands/create.py", line 939, in create_app
self.install_stub_binary(app=app)
File "/Users/ralph/.venv/MosamaticDesktop2.0/lib/python3.12/site-packages/briefcase/commands/create.py", line 433, in install_stub_binary
self.tools.os.chmod(unbuilt_executable_path, 0o755)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/ralph/dev/tools/MosamaticDesktop2.0/mosamaticdesktop/build/mosamaticdesktop/macos/app/Mosamatic Desktop 2.0.app/Contents/MacOS/Stub.0'
(MosamaticDesktop2.0) ~/dev/tools/MosamaticDesktop2.0/mosamaticdesktop$

@rbrecheisen
Copy link

Ok, my bad. Turns out that my project's name "Mosamatic Desktop 2.0" was causing the problem because of the trailing ".0" in this name. I renamed the project to "Mosamatic Desktop 2" and it works... :)

Ralph

@freakboy3742
Copy link
Member

Ok, my bad. Turns out that my project's name "Mosamatic Desktop 2.0" was causing the problem because of the trailing ".0" in this name. I renamed the project to "Mosamatic Desktop 2" and it works... :)

Ok - That's an interesting result, and definitely a bug. I've opened #2151 to track the issue.

The fix is reasonably straightforward, if you'd like to try your hand at fixing the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. good first issue Is this your first time contributing? This could be a good place to start! macOS The issue relates to Apple macOS support. windows The issue relates to Microsoft Windows support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants