beeware / briefcase

Tools to support converting a Python project into a standalone native application.
https://briefcase.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.66k stars 372 forks source link

Unable to generate manifest during briefcase package #1050

Closed MarleyLP closed 1 year ago

MarleyLP commented 1 year ago

Describe the bug

I am doing the tutorials up to the briefcase run command but when I try to run the briefcase package command I get this error

(bwv) C:\Users\mlphelps\bw\helloworld>briefcase package

[helloworld] Building MSI...
Compiling application manifest...
Compiling...

Unable to generate manifest for app helloworld.

And a pop-up that pops up a second time after I close it that says

heat.exe - This application could not be started.

This application could not be started.

Do you want to view information about this issue?

Yes No

The Yes option links to https://learn.microsoft.com/en-us/dotnet/framework/install/application-not-started?version=(null)&processName=heat.exe&platform=0009&osver=6&isServer=0&shimver=4.0.30319.0 which I followed but it did not help, the .NET Framework Repair Tool was unable to resolve the issue.

See attached screenshot.

I read this similar issue https://github.com/beeware/briefcase/issues/530 and thought that perhaps the path length was too long, but I shortened it to C:\Users\mlphelps\bw\helloworld but that also did not fix the issue.

Steps to reproduce

Follow the tutorial steps up until the briefcase package command.

Expected behavior

Create and package an MSI

Screenshots

Capture

Environment

Logs

Date/Time:       2023-01-17 10:26:04 
Command line:    C:\Users\mlphelps\bw\bwv\Scripts\briefcase package

OS Release:      Windows 10
OS Version:      10.0.19044
Architecture:    AMD64
Platform:        Windows-10-10.0.19044-SP0

Python exe:      C:\Users\mlphelps\bw\bwv\Scripts\python.exe
Python version:  3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Virtual env:     True
Conda env:       False

Briefcase:       0.3.11
Target platform: windows
Target format:   app

Environment Variables:
    ALLUSERSPROFILE=C:\ProgramData
    APPDATA=C:\Users\mlphelps\AppData\Roaming
    COMMONPROGRAMFILES=C:\Program Files\Common Files
    COMMONPROGRAMFILES(X86)=C:\Program Files (x86)\Common Files
    COMMONPROGRAMW6432=C:\Program Files\Common Files
    COMPUTERNAME=IG-11
    COMSPEC=C:\Windows\system32\cmd.exe
    DRIVERDATA=C:\Windows\System32\Drivers\DriverData
    FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
    FPS_BROWSER_USER_PROFILE_STRING=Default
    HOMEDRIVE=C:
    HOMEPATH=\Users\mlphelps
    LOCALAPPDATA=C:\Users\mlphelps\AppData\Local
    LOGONSERVER=\\YODA
    NUMBER_OF_PROCESSORS=8
    ONEDRIVE=C:\Users\mlphelps\OneDrive
    OS=Windows_NT
    PATH=C:\Users\mlphelps\bw\bwv\Scripts;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Users\mlphelps\AppData\Local\Microsoft\WindowsApps;C:\Users\mlphelps\AppData\Local\Programs\Microsoft VS Code\bin
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    PROCESSOR_ARCHITECTURE=AMD64
    PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
    PROCESSOR_LEVEL=6
    PROCESSOR_REVISION=8c01
    PROGRAMDATA=C:\ProgramData
    PROGRAMFILES=C:\Program Files
    PROGRAMFILES(X86)=C:\Program Files (x86)
    PROGRAMW6432=C:\Program Files
    PROMPT=(bwv) $P$G
    PSMODULEPATH=%ProgramFiles%\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
    PUBLIC=C:\Users\Public
    PYTHONUSERBASE=C:\Users\mlphelps\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages
    SESSIONNAME=Console
    SYSTEMDRIVE=C:
    SYSTEMROOT=C:\Windows
    TEMP=C:\Users\mlphelps\AppData\Local\Temp
    TMP=C:\Users\mlphelps\AppData\Local\Temp
    USERDOMAIN_ROAMINGPROFILE=COMPUCAL
    USERPROFILE=C:\Users\mlphelps
    VIRTUAL_ENV=C:\Users\mlphelps\bw\bwv
    VIRTUAL_ENV_PROMPT=(bwv) 
    WINDIR=C:\Windows
    ZES_ENABLE_SYSMAN=1
    _OLD_VIRTUAL_PATH=C:\Program Files\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Users\mlphelps\AppData\Local\Microsoft\WindowsApps;C:\Users\mlphelps\AppData\Local\Programs\Microsoft VS Code\bin
    _OLD_VIRTUAL_PROMPT=$P$G

Briefcase Log:
[10:26:02]                                                                                                                                                           __init__.py:114
           [helloworld] Building MSI...                                                                                                                              __init__.py:114
           Compiling application manifest...                                                                                                                         __init__.py:117
                                                                                                                                                                   subprocess.py:516
           >>> Running Command:                                                                                                                                    subprocess.py:517
           >>>     'C:\Users\mlphelps\AppData\Local\BeeWare\briefcase\Cache\tools\wix\heat.exe' dir src -nologo -gg -sfrag -sreg -srd -scom -dr helloworld_ROOTDIR subprocess.py:518
           -cg helloworld_COMPONENTS -var var.SourceDir -out helloworld-manifest.wxs                                                                                                
           >>> Working Directory:                                                                                                                                  subprocess.py:525
           >>>     C:\Users\mlphelps\bw\helloworld\windows\app\Hello World                                                                                         subprocess.py:526
[10:26:04] >>> Return code: 2148734720                                                                                                                             subprocess.py:553
           Compiling...                                                                                                                                              __init__.py:118
                                                                                                                                                                      __main__.py:27
           Unable to generate manifest for app helloworld.                                                                                                            __main__.py:28

┌─────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────────┐
│ C:\Users\mlphelps\bw\bwv\lib\site-packages\briefcase\platforms\windows\__init__.py:119 in package_app                                                                            │
│                                                                                                                                                                                  │
│   116 │   │   try:                                                                                                                                                               │
│   117 │   │   │   self.logger.info("Compiling application manifest...")                                                                                                          │
│   118 │   │   │   with self.input.wait_bar("Compiling..."):                                                                                                                      │
│ > 119 │   │   │   │   self.tools.subprocess.run(                                                                                                                                 │
│   120 │   │   │   │   │   [                                                                                                                                                      │
│   121 │   │   │   │   │   │   self.tools.wix.heat_exe,                                                                                                                           │
│   122 │   │   │   │   │   │   "dir",                                                                                                                                             │
│                                                                                                                                                                                  │
│ ┌───────────────────────────────────────────── locals ─────────────────────────────────────────────┐                                                                             │
│ │    app = <com.example.helloworld v0.0.1 AppConfig>                                               │                                                                             │
│ │ kwargs = {'packaging_format': 'msi', 'sign_app': True, 'adhoc_sign': False, 'identity': None}    │                                                                             │
│ │   self = <briefcase.platforms.windows.app.WindowsAppPackageCommand object at 0x00000233B8103EE0> │                                                                             │
│ └──────────────────────────────────────────────────────────────────────────────────────────────────┘                                                                             │
│                                                                                                                                                                                  │
│ C:\Users\mlphelps\bw\bwv\lib\site-packages\briefcase\integrations\subprocess.py:127 in inner                                                                                     │
│                                                                                                                                                                                  │
│   124 │   │   │   with sub.tools.input.release_console_control():                                                                                                                │
│   125 │   │   │   │   return sub_method(sub, args, **kwargs)                                                                                                                     │
│   126 │   │   else:                                                                                                                                                              │
│ > 127 │   │   │   return sub_method(sub, args, **kwargs)                                                                                                                         │
│   128 │                                                                                                                                                                          │
│   129 │   return inner                                                                                                                                                           │
│   130                                                                                                                                                                            │
│                                                                                                                                                                                  │
│ ┌───────────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────────┐                                                     │
│ │                    args = [                                                                                              │                                                     │
│ │                           │   WindowsPath('C:/Users/mlphelps/AppData/Local/BeeWare/briefcase/Cache/tools/wix/heat.exe'), │                                                     │
│ │                           │   'dir',                                                                                     │                                                     │
│ │                           │   'src',                                                                                     │                                                     │
│ │                           │   '-nologo',                                                                                 │                                                     │
│ │                           │   '-gg',                                                                                     │                                                     │
│ │                           │   '-sfrag',                                                                                  │                                                     │
│ │                           │   '-sreg',                                                                                   │                                                     │
│ │                           │   '-srd',                                                                                    │                                                     │
│ │                           │   '-scom',                                                                                   │                                                     │
│ │                           │   '-dr',                                                                                     │                                                     │
│ │                           │   ... +7                                                                                     │                                                     │
│ │                           ]                                                                                              │                                                     │
│ │              executable = 'C:\\Users\\mlphelps\\AppData\\Local\\BeeWare\\briefcase\\Cache\\tools\\wix\\heat.exe'         │                                                     │
│ │                  kwargs = {'check': True, 'cwd': WindowsPath('C:/Users/mlphelps/bw/helloworld/windows/app/Hello World')} │                                                     │
│ │ remove_dynamic_elements = False                                                                                          │                                                     │
│ │                     sub = <briefcase.integrations.subprocess.Subprocess object at 0x00000233B8142620>                    │                                                     │
│ │              sub_method = <function Subprocess.run at 0x00000233B8074430>                                                │                                                     │
│ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘                                                     │
│                                                                                                                                                                                  │
│ C:\Users\mlphelps\bw\bwv\lib\site-packages\briefcase\integrations\subprocess.py:284 in run                                                                                       │
│                                                                                                                                                                                  │
│   281 │   │   if stream_output or (                                                                                                                                              │
│   282 │   │   │   self.tools.input.is_console_controlled and not is_output_redirected                                                                                            │
│   283 │   │   ):                                                                                                                                                                 │
│ > 284 │   │   │   return self._run_and_stream_output(args, **kwargs)                                                                                                             │
│   285 │   │                                                                                                                                                                      │
│   286 │   │   # Otherwise, invoke run() normally.                                                                                                                                │
│   287 │   │   self._log_command(args)                                                                                                                                            │
│                                                                                                                                                                                  │
│ ┌─────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────┐                                                        │
│ │                 args = [                                                                                              │                                                        │
│ │                        │   WindowsPath('C:/Users/mlphelps/AppData/Local/BeeWare/briefcase/Cache/tools/wix/heat.exe'), │                                                        │
│ │                        │   'dir',                                                                                     │                                                        │
│ │                        │   'src',                                                                                     │                                                        │
│ │                        │   '-nologo',                                                                                 │                                                        │
│ │                        │   '-gg',                                                                                     │                                                        │
│ │                        │   '-sfrag',                                                                                  │                                                        │
│ │                        │   '-sreg',                                                                                   │                                                        │
│ │                        │   '-srd',                                                                                    │                                                        │
│ │                        │   '-scom',                                                                                   │                                                        │
│ │                        │   '-dr',                                                                                     │                                                        │
│ │                        │   ... +7                                                                                     │                                                        │
│ │                        ]                                                                                              │                                                        │
│ │ is_output_redirected = None                                                                                           │                                                        │
│ │               kwargs = {'check': True, 'cwd': WindowsPath('C:/Users/mlphelps/bw/helloworld/windows/app/Hello World')} │                                                        │
│ │                 self = <briefcase.integrations.subprocess.Subprocess object at 0x00000233B8142620>                    │                                                        │
│ │        stream_output = False                                                                                          │                                                        │
│ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘                                                        │
│                                                                                                                                                                                  │
│ C:\Users\mlphelps\bw\bwv\lib\site-packages\briefcase\integrations\subprocess.py:350 in _run_and_stream_output                                                                    │
│                                                                                                                                                                                  │
│   347 │   │   self._log_return_code(return_code)                                                                                                                                 │
│   348 │   │                                                                                                                                                                      │
│   349 │   │   if check and return_code:                                                                                                                                          │
│ > 350 │   │   │   raise subprocess.CalledProcessError(return_code, args, stderr=stderr)                                                                                          │
│   351 │   │                                                                                                                                                                      │
│   352 │   │   return subprocess.CompletedProcess(args, return_code, stderr=stderr)                                                                                               │
│   353                                                                                                                                                                            │
│                                                                                                                                                                                  │
│ ┌──────────────────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────────────────┐                                      │
│ │        args = [                                                                                                                         │                                      │
│ │               │   WindowsPath('C:/Users/mlphelps/AppData/Local/BeeWare/briefcase/Cache/tools/wix/heat.exe'),                            │                                      │
│ │               │   'dir',                                                                                                                │                                      │
│ │               │   'src',                                                                                                                │                                      │
│ │               │   '-nologo',                                                                                                            │                                      │
│ │               │   '-gg',                                                                                                                │                                      │
│ │               │   '-sfrag',                                                                                                             │                                      │
│ │               │   '-sreg',                                                                                                              │                                      │
│ │               │   '-srd',                                                                                                               │                                      │
│ │               │   '-scom',                                                                                                              │                                      │
│ │               │   '-dr',                                                                                                                │                                      │
│ │               │   ... +7                                                                                                                │                                      │
│ │               ]                                                                                                                         │                                      │
│ │       check = True                                                                                                                      │                                      │
│ │      kwargs = {'cwd': WindowsPath('C:/Users/mlphelps/bw/helloworld/windows/app/Hello World'), 'stdout': -1, 'stderr': -2, 'bufsize': 1} │                                      │
│ │     process = <Popen: returncode: 2148734720 args: ['C:\\Users\\mlphelps\\AppData\\Local\\...>                                          │                                      │
│ │ return_code = 2148734720                                                                                                                │                                      │
│ │        self = <briefcase.integrations.subprocess.Subprocess object at 0x00000233B8142620>                                               │                                      │
│ │      stderr = None                                                                                                                      │                                      │
│ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘                                      │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
CalledProcessError: Command '[WindowsPath('C:/Users/mlphelps/AppData/Local/BeeWare/briefcase/Cache/tools/wix/heat.exe'), 'dir', 'src', '-nologo', '-gg', '-sfrag', '-sreg', '-srd', '-scom', '-dr', 'helloworld_ROOTDIR', '-cg', 'helloworld_COMPONENTS', '-var', 'var.SourceDir', '-out', 'helloworld-manifest.wxs']' returned non-zero exit status 2148734720.

The above exception was the direct cause of the following exception:

┌─────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────────┐
│ C:\Users\mlphelps\bw\bwv\lib\site-packages\briefcase\__main__.py:21 in main                                                                                                      │
│                                                                                                                                                                                  │
│   18 │   │   options = command.parse_options(extra=extra_cmdline)                                                                                                                │
│   19 │   │   command.check_obsolete_data_dir()                                                                                                                                   │
│   20 │   │   command.parse_config(Path.cwd() / "pyproject.toml")                                                                                                                 │
│ > 21 │   │   command(**options)                                                                                                                                                  │
│   22 │   except HelpText as e:                                                                                                                                                   │
│   23 │   │   logger.info()                                                                                                                                                       │
│   24 │   │   logger.info(str(e))                                                                                                                                                 │
│                                                                                                                                                                                  │
│ ┌─────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────┐                                                        │
│ │       command = <briefcase.platforms.windows.app.WindowsAppPackageCommand object at 0x00000233B8103EE0>               │                                                        │
│ │       Command = <class 'briefcase.platforms.windows.app.WindowsAppPackageCommand'>                                    │                                                        │
│ │       console = <briefcase.console.Console object at 0x00000233B5970040>                                              │                                                        │
│ │             e = BriefcaseCommandError('Unable to generate manifest for app helloworld.')                              │                                                        │
│ │ extra_cmdline = []                                                                                                    │                                                        │
│ │        logger = <briefcase.console.Log object at 0x00000233B59ADFF0>                                                  │                                                        │
│ │       options = {'update': False, 'packaging_format': 'msi', 'sign_app': True, 'adhoc_sign': False, 'identity': None} │                                                        │
│ │        result = 200                                                                                                   │                                                        │
│ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘                                                        │
│                                                                                                                                                                                  │
│ C:\Users\mlphelps\bw\bwv\lib\site-packages\briefcase\commands\package.py:108 in __call__                                                                                         │
│                                                                                                                                                                                  │
│   105 │   │   else:                                                                                                                                                              │
│   106 │   │   │   state = None                                                                                                                                                   │
│   107 │   │   │   for app_name, app in sorted(self.apps.items()):                                                                                                                │
│ > 108 │   │   │   │   state = self._package_app(                                                                                                                                 │
│   109 │   │   │   │   │   app, update=update, **full_options(state, options)                                                                                                     │
│   110 │   │   │   │   )                                                                                                                                                          │
│   111                                                                                                                                                                            │
│                                                                                                                                                                                  │
│ ┌────────────────────────────────────────────── locals ──────────────────────────────────────────────┐                                                                           │
│ │      app = <com.example.helloworld v0.0.1 AppConfig>                                               │                                                                           │
│ │ app_name = 'helloworld'                                                                            │                                                                           │
│ │  options = {'packaging_format': 'msi', 'sign_app': True, 'adhoc_sign': False, 'identity': None}    │                                                                           │
│ │     self = <briefcase.platforms.windows.app.WindowsAppPackageCommand object at 0x00000233B8103EE0> │                                                                           │
│ │    state = None                                                                                    │                                                                           │
│ │   update = False                                                                                   │                                                                           │
│ └────────────────────────────────────────────────────────────────────────────────────────────────────┘                                                                           │
│                                                                                                                                                                                  │
│ C:\Users\mlphelps\bw\bwv\lib\site-packages\briefcase\commands\package.py:53 in _package_app                                                                                      │
│                                                                                                                                                                                  │
│    50 │   │                                                                                                                                                                      │
│    51 │   │   self.verify_app_tools(app)                                                                                                                                         │
│    52 │   │                                                                                                                                                                      │
│ >  53 │   │   state = self.package_app(                                                                                                                                          │
│    54 │   │   │   app, packaging_format=packaging_format, **full_options(state, options)                                                                                         │
│    55 │   │   )                                                                                                                                                                  │
│    56                                                                                                                                                                            │
│                                                                                                                                                                                  │
│ ┌─────────────────────────────────────────────────── locals ────────────────────────────────────────────────────┐                                                                │
│ │              app = <com.example.helloworld v0.0.1 AppConfig>                                                  │                                                                │
│ │      binary_file = WindowsPath('C:/Users/mlphelps/bw/helloworld/windows/app/Hello World/src/Hello World.exe') │                                                                │
│ │          options = {'sign_app': True, 'adhoc_sign': False, 'identity': None}                                  │                                                                │
│ │ packaging_format = 'msi'                                                                                      │                                                                │
│ │             self = <briefcase.platforms.windows.app.WindowsAppPackageCommand object at 0x00000233B8103EE0>    │                                                                │
│ │            state = None                                                                                       │                                                                │
│ │    template_file = WindowsPath('C:/Users/mlphelps/bw/helloworld/windows/app/Hello World')                     │                                                                │
│ │           update = False                                                                                      │                                                                │
│ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────┘                                                                │
│                                                                                                                                                                                  │
│ C:\Users\mlphelps\bw\bwv\lib\site-packages\briefcase\platforms\windows\__init__.py:143 in package_app                                                                            │
│                                                                                                                                                                                  │
│   140 │   │   │   │   │   cwd=self.bundle_path(app),                                                                                                                             │
│   141 │   │   │   │   )                                                                                                                                                          │
│   142 │   │   except subprocess.CalledProcessError as e:                                                                                                                         │
│ > 143 │   │   │   raise BriefcaseCommandError(                                                                                                                                   │
│   144 │   │   │   │   f"Unable to generate manifest for app {app.app_name}."                                                                                                     │
│   145 │   │   │   ) from e                                                                                                                                                       │
│   146                                                                                                                                                                            │
│                                                                                                                                                                                  │
│ ┌───────────────────────────────────────────── locals ─────────────────────────────────────────────┐                                                                             │
│ │    app = <com.example.helloworld v0.0.1 AppConfig>                                               │                                                                             │
│ │ kwargs = {'packaging_format': 'msi', 'sign_app': True, 'adhoc_sign': False, 'identity': None}    │                                                                             │
│ │   self = <briefcase.platforms.windows.app.WindowsAppPackageCommand object at 0x00000233B8103EE0> │                                                                             │
│ └──────────────────────────────────────────────────────────────────────────────────────────────────┘                                                                             │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
BriefcaseCommandError: Unable to generate manifest for app helloworld.

Additional context

I don't know if this could be related, but when I run briefcase run I do see print statements go to the console, even though the tutorial says this should not happen because it should be running as a standalone app.

"You’ll notice that the console output we saw earlier won’t be visible anymore. This is because we are now running a standalone, packaged app that has no (visible) console to which it can output."

I don't know if this is related, but the similar issue mentioned above (https://github.com/beeware/briefcase/issues/530) had python within their Beeware srcC:\Personal\Projects\Python_Projects\beeware_test\timezonebuddy\windows\Timezone Buddy\src\python\, I do not have my python installed within my Beeware src, or anywhere else in my file path.

rmartin16 commented 1 year ago

This looks like a symptom of beeware/briefcase#922. Can you see if the workaround there resolves this for you?

MarleyLP commented 1 year ago

Thank you very much, especially for the quick reply.

I had installed Python from the Windows Store and the second workaround "Move the %LOCALAPPDATA%\Packages\<Python>\LocalCache\Local\BeeWare directory to %LOCALAPPDATA%\BeeWare", I did not try the first workaround but I assume it would have also worked.