panda3d / panda3d

Powerful, mature open-source cross-platform game engine for Python and C++, developed by Disney and CMU
https://www.panda3d.org/
Other
4.53k stars 786 forks source link

Crash on in deployed application when built for Python 3.11 #1423

Closed miklesz closed 1 year ago

miklesz commented 1 year ago

Description

I'm having issues with my app builds when I want to use Python 3.11 (which, according to release notes, has been supported since Panda3D version 1.10.12: https://github.com/panda3d/panda3d/releases). At least under macOS.

To isolate the error, I created 2 (almost) identical, simple PyCharm projects, differing only in Python versions: 3.10 (more precisely: 3.10.9) and 3.11 (more precisely: 3.11.1).

Steps to Reproduce and Environment

Here's the code for the main (and only) script, main.py, which, as you can see, creates an object of the ShowBase() class, prints some basic information about the existing environment to the console, and opens a basic window:

import platform

from direct.showbase.ShowBase import ShowBase
from panda3d.core import ConfigPageManager, PandaSystem

base = ShowBase()

print(ConfigPageManager.getGlobalPtr())
print('platform.python_version:', platform.python_version())
print('platform.machine:', platform.machine())
print('base.win.gsg.driver_vendor:', base.win.gsg.driver_vendor)
print('base.win.gsg.driver_renderer:', base.win.gsg.driver_renderer)
print('base.win.gsg.supports_basic_shaders:', base.win.gsg.supports_basic_shaders)
print("PandaSystem.version_string:", PandaSystem.version_string)

base.run()

Here is my requirements.txt (as you can see, it only requires Panda3D):

Panda3D

Here is my setup.py (as you can see, it builds the GUI app, sets up file logging, and includes basic plugins):

from setuptools import setup

setup(
    name='Panda3D_Python3.10',
    options={
        'build_apps': {
            # Build Panda3D_Python3.10 as a GUI application
            'gui_apps': {
                'Panda3D_Python3.10': 'main.py',
            },

            # Set up output logging, important for GUI apps!
            'log_filename': '$USER_APPDATA/Panda3D_Python3.10/output.log',
            'log_append': False,

            # Include the OpenGL renderer and OpenAL audio plug-in
            'plugins': [
                'pandagl',
                'p3openal_audio',
            ],
        }
    }
)

(version for 3.11 differs only in that it uses the string: Panda3D_Python3.11)

And this is how I call building the application (as you can see, completely standard):

#!/bin/sh
python setup.py build_apps

And now this: under PyCharm (that is, actually launched from the console, as an argument of the Python interpreter) everything works fine, both under 3.10 and under 3.11 (the only obvious difference is in the version number that is printed). The following appears on the console:

3.10:

/Users/miklesz/PycharmProjects/Panda3D_Python3.10/venv/bin/python /Users/miklesz/PycharmProjects/Panda3D_Python3.10/main.py 
Known pipe types:
  CocoaGraphicsPipe
(all display modules loaded.)
0 explicit pages:

2 implicit pages:
  /Users/miklesz/PycharmProjects/Panda3D_Python3.10/venv/lib/python3.10/site-packages/panda3d/etc/Config.prc
  /Users/miklesz/PycharmProjects/Panda3D_Python3.10/venv/lib/python3.10/site-packages/panda3d/etc/Confauto.prc

platform.python_version: 3.10.9
platform.machine: x86_64
base.win.gsg.driver_vendor: Apple
base.win.gsg.driver_renderer: Apple M1
base.win.gsg.supports_basic_shaders: True
PandaSystem.version_string: 1.10.13

Process finished with exit code 0

3.11:

/Users/miklesz/PycharmProjects/Panda3D_Python3.11/venv/bin/python /Users/miklesz/PycharmProjects/Panda3D_Python3.11/main.py 
Known pipe types:
  CocoaGraphicsPipe
(all display modules loaded.)
0 explicit pages:

2 implicit pages:
  /Users/miklesz/PycharmProjects/Panda3D_Python3.11/venv/lib/python3.11/site-packages/panda3d/etc/Config.prc
  /Users/miklesz/PycharmProjects/Panda3D_Python3.11/venv/lib/python3.11/site-packages/panda3d/etc/Confauto.prc

platform.python_version: 3.11.1
platform.machine: x86_64
base.win.gsg.driver_vendor: Apple
base.win.gsg.driver_renderer: Apple M1
base.win.gsg.supports_basic_shaders: True
PandaSystem.version_string: 1.10.13

Process finished with exit code 0

I am able to build an app for both 3.10 and 3.11. The logs from the application build are as follows (yes, I see some disturbing things there, although I don't know what to do with them):

3.10:

(venv) (base) miklesz@MBP-Miklesz Panda3D_Python3.10 % /bin/sh /Users/miklesz/PycharmProjects/Panda3D_Python3.10/build.sh
running build_apps
Building platforms: manylinux2010_x86_64,macosx_10_9_x86_64,win_amd64
Gathering wheels for platform: manylinux2010_x86_64
Looking in indexes: https://pypi.org/simple, https://archive.panda3d.org/simple/opt, https://archive.panda3d.org/thirdparty
Collecting Panda3D
  File was already downloaded /Users/miklesz/PycharmProjects/Panda3D_Python3.10/build/__whl_cache__/manylinux2010_x86_64_cp310/panda3d-1.10.13+opt-cp310-cp310-manylinux2010_x86_64.whl
Successfully downloaded Panda3D
Building runtime for platform: manylinux2010_x86_64
There are some missing modules: ['_bootlocale']
Copying game files for platform: manylinux2010_x86_64
Gathering wheels for platform: macosx_10_9_x86_64
Looking in indexes: https://pypi.org/simple, https://archive.panda3d.org/simple/opt, https://archive.panda3d.org/thirdparty
Collecting Panda3D
  File was already downloaded /Users/miklesz/PycharmProjects/Panda3D_Python3.10/build/__whl_cache__/macosx_10_9_x86_64_cp310/panda3d-1.10.13+opt-cp310-cp310-macosx_10_9_x86_64.whl
Successfully downloaded Panda3D
Building runtime for platform: macosx_10_9_x86_64
warning: build_apps: Missing audio plugin p3fmod_audio referenced in PRC data, replacing with p3openal_audio

Copying game files for platform: macosx_10_9_x86_64
Bundling macOS app into /Users/miklesz/PycharmProjects/Panda3D_Python3.10/build/macosx_10_9_x86_64/Panda3D_Python3.10.app
Gathering wheels for platform: win_amd64
Looking in indexes: https://pypi.org/simple, https://archive.panda3d.org/simple/opt, https://archive.panda3d.org/thirdparty
Collecting Panda3D
  File was already downloaded /Users/miklesz/PycharmProjects/Panda3D_Python3.10/build/__whl_cache__/win_amd64_cp310/panda3d-1.10.13+opt-cp310-cp310-win_amd64.whl
Successfully downloaded Panda3D
Building runtime for platform: win_amd64
There are some missing modules: ['_bisect', '_blake2', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_contextvars', '_datetime', '_heapq', '_md5', '_multibytecodec', '_opcode', '_pickle', '_posixsubprocess', '_random', '_sha1', '_sha256', '_sha3', '_sha512', '_statistics', '_struct', 'array', 'binascii', 'grp', 'math', 'zlib']
warning: build_apps: could not find dependency api-ms-win-core-path-l1-1-0.dll (referenced by python310.dll)

Copying game files for platform: win_amd64
(venv) (base) miklesz@MBP-Miklesz Panda3D_Python3.10 % 

3.11:

(venv) (base) miklesz@MBP-Miklesz Panda3D_Python3.11 % /bin/sh /Users/miklesz/PycharmProjects/Panda3D_Python3.11/build.sh
running build_apps
Building platforms: manylinux2014_x86_64,macosx_10_9_x86_64,win_amd64
Gathering wheels for platform: manylinux2014_x86_64
Looking in indexes: https://pypi.org/simple, https://archive.panda3d.org/simple/opt, https://archive.panda3d.org/thirdparty
Collecting Panda3D
  File was already downloaded /Users/miklesz/PycharmProjects/Panda3D_Python3.11/build/__whl_cache__/manylinux2014_x86_64_cp311/panda3d-1.10.13+opt-cp311-cp311-manylinux2014_x86_64.whl
Successfully downloaded Panda3D
Building runtime for platform: manylinux2014_x86_64
There are some missing modules: ['_bootlocale']
Copying game files for platform: manylinux2014_x86_64
Gathering wheels for platform: macosx_10_9_x86_64
Looking in indexes: https://pypi.org/simple, https://archive.panda3d.org/simple/opt, https://archive.panda3d.org/thirdparty
Collecting Panda3D
  File was already downloaded /Users/miklesz/PycharmProjects/Panda3D_Python3.11/build/__whl_cache__/macosx_10_9_x86_64_cp311/panda3d-1.10.13+opt-cp311-cp311-macosx_10_9_x86_64.whl
Successfully downloaded Panda3D
Building runtime for platform: macosx_10_9_x86_64
warning: build_apps: Missing audio plugin p3fmod_audio referenced in PRC data, replacing with p3openal_audio

Copying game files for platform: macosx_10_9_x86_64
Bundling macOS app into /Users/miklesz/PycharmProjects/Panda3D_Python3.11/build/macosx_10_9_x86_64/Panda3D_Python3.11.app
Gathering wheels for platform: win_amd64
Looking in indexes: https://pypi.org/simple, https://archive.panda3d.org/simple/opt, https://archive.panda3d.org/thirdparty
Collecting Panda3D
  File was already downloaded /Users/miklesz/PycharmProjects/Panda3D_Python3.11/build/__whl_cache__/win_amd64_cp311/panda3d-1.10.13+opt-cp311-cp311-win_amd64.whl
Successfully downloaded Panda3D
Building runtime for platform: win_amd64
There are some missing modules: ['_bisect', '_blake2', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_contextvars', '_datetime', '_heapq', '_md5', '_multibytecodec', '_opcode', '_pickle', '_posixsubprocess', '_random', '_sha1', '_sha256', '_sha3', '_sha512', '_statistics', '_struct', '_typing', 'array', 'binascii', 'grp', 'math', 'zlib']
warning: build_apps: could not find dependency api-ms-win-core-path-l1-1-0.dll (referenced by python311.dll)

Copying game files for platform: win_amd64
(venv) (base) miklesz@MBP-Miklesz Panda3D_Python3.11 % 

The problems start when I try to run the built app.

For 3.10, everything works fine, and the output.log looks like this (it's a bit different than in PyCharm, in the context of configuration files, but it's probably understandable):

Known pipe types:
  CocoaGraphicsPipe
(all display modules loaded.)
0 explicit pages:

1 implicit pages:
  builtin

platform.python_version: 3.10.9
platform.machine: x86_64
base.win.gsg.driver_vendor: Apple
base.win.gsg.driver_renderer: Apple M1
base.win.gsg.supports_basic_shaders: True
PandaSystem.version_string: 1.10.13

For 3.11, the application crashes immediately, and the output.log is empty (I attach the log from the Problem Report):

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               Panda3D_Python3.11 [49637]
Path:                  /Users/USER/*/Panda3D_Python3.11.app/Contents/MacOS/Panda3D_Python3.11
Identifier:            
Version:               0.0.0
Code Type:             X86-64 (Translated)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2022-12-26 16:48:49.7246 +0100
OS Version:            macOS 13.1 (22C65)
Report Version:        12
Anonymous UUID:        57AC0780-B90F-4309-3056-AA325F7DC527

Sleep/Wake UUID:       2CB27338-D650-40AC-B038-14D98E577FF8

Time Awake Since Boot: 350000 seconds
Time Since Wake:       11307 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000209253f8b
Exception Codes:       0x0000000000000001, 0x0000000209253f8b

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [49637]

VM Region Info: 0x209253f8b is not in any region.  Bytes after previous region: 137518988  Bytes before following region: 4170133621
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      unused __TEXT               200f2c000-200f2e000    [    8K] r--/r-- SM=NUL  ...ed lib __TEXT
--->  GAP OF 0x100c19000 BYTES
      Stack Guard                 301b47000-30534b000    [ 56.0M] ---/rwx SM=NUL  

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_platform.dylib            0x7ff807b8cf75 _platform_strcmp + 85
1   libpython3.11.dylib                    0x109acb773 find_frozen + 307
2   libpython3.11.dylib                    0x109acc0cd _imp_find_frozen + 125
3   libpython3.11.dylib                    0x1099bb304 cfunction_vectorcall_FASTCALL_KEYWORDS + 68
4   libpython3.11.dylib                    0x109a8670a _PyEval_EvalFrameDefault + 73082
5   libpython3.11.dylib                    0x109a89690 _PyEval_Vector + 128
6   libpython3.11.dylib                    0x10995842d object_vacall + 429
7   libpython3.11.dylib                    0x1099581e3 PyObject_CallMethodObjArgs + 227
8   libpython3.11.dylib                    0x109ac7e3d PyImport_ImportModuleLevelObject + 1069
9   libpython3.11.dylib                    0x109a6c81f builtin___import__ + 191
10  libpython3.11.dylib                    0x1099bb304 cfunction_vectorcall_FASTCALL_KEYWORDS + 68
11  libpython3.11.dylib                    0x109956f78 _PyObject_CallFunctionVa + 168
12  libpython3.11.dylib                    0x109956eac PyObject_CallFunction + 156
13  libpython3.11.dylib                    0x109ac772f PyImport_Import + 335
14  libpython3.11.dylib                    0x109a8a99a _PyCodecRegistry_Init + 682
15  libpython3.11.dylib                    0x109a8e490 _PyCodec_Lookup + 912
16  libpython3.11.dylib                    0x109a294aa config_get_codec_name + 74
17  libpython3.11.dylib                    0x109aee768 init_interp_main + 568
18  libpython3.11.dylib                    0x109aee429 pyinit_main + 57
19  libpython3.11.dylib                    0x109aeb9bb Py_InitializeFromConfig + 1083
20  libpython3.11.dylib                    0x109af0516 Py_InitializeEx + 278
21  Panda3D_Python3.11                     0x100c1b4d8 Py_FrozenMain + 344
22  Panda3D_Python3.11                     0x100c1ba7b main + 891
23  dyld                                   0x200e3c310 start + 2432

Thread 1:: com.apple.rosetta.exceptionserver
0   runtime                             0x7ff7fff24614 0x7ff7fff20000 + 17940
1   runtime                             0x7ff7fff30530 0x7ff7fff20000 + 66864
2   runtime                             0x7ff7fff31f30 0x7ff7fff20000 + 73520

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x00000001092543a0  rcx: 0x0000000000000000  rdx: 0x0000000000000001
  rdi: 0x000000010975e9e0  rsi: 0x0000000209253f8b  rbp: 0x0000000305b438c0  rsp: 0x0000000305b438c0
   r8: 0x00000000000000e3   r9: 0x0000000000000070  r10: 0x000000010919e3a8  r11: 0x0000000000000001
  r12: 0x0000000000000001  r13: 0x000000010975e9e0  r14: 0x0000000305b43910  r15: 0x000000010975e9b0
  rip: <unavailable>       rfl: 0x0000000000000203
 tmp0: 0x00007ff897387d34 tmp1: 0x000000010a563120 tmp2: 0x00007ff807b8cf20

Binary Images:
    0x7ff807b8c000 -     0x7ff807b95ff7 libsystem_platform.dylib (*) <f314b62b-98f4-3a7c-8296-8739f8b6855a> /usr/lib/system/libsystem_platform.dylib
       0x1098b3000 -        0x109c92fff libpython3.11.dylib (*) <41aefab3-e30a-3aed-806a-ac88734a771b> /Users/USER/*/Panda3D_Python3.11.app/Contents/Frameworks/libpython3.11.dylib
       0x100c19000 -        0x100c1bfff Panda3D_Python3.11 (*) <01b09742-24af-31d4-a96c-a20d41b5ba68> /Users/USER/*/Panda3D_Python3.11.app/Contents/MacOS/Panda3D_Python3.11
       0x200e36000 -        0x200ecdfff dyld (*) <bb7a0970-8c62-3dce-a7a2-5cec9c501f11> /usr/lib/dyld
    0x7ff7fff20000 -     0x7ff7fff4ffff runtime (*) <d592bc4a-4a21-348f-a406-e12f9cd2f27c> /usr/libexec/rosetta/runtime
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=384.7M resident=0K(0%) swapped_out_or_unallocated=384.7M(100%)
Writable regions: Total=815.9M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=815.9M(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Kernel Alloc Once                    8K        1 
MALLOC                           154.1M       14 
MALLOC guard page                   96K        4 
MALLOC_MEDIUM (reserved)         120.0M        1         reserved VM address space (unallocated)
MALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)
Rosetta Arena                     4096K        2 
Rosetta Generic                    980K      242 
Rosetta IndirectBranch              96K        2 
Rosetta JIT                      128.0M        1 
Rosetta Return Stack                20K        2 
Rosetta Thread Context              20K        2 
Stack                             8176K        1 
Stack Guard                       56.0M        1 
VM_ALLOCATE                       14.2M       10 
__DATA                            15.8M      266 
__DATA_CONST                      13.1M      163 
__DATA_DIRTY                       632K       96 
__FONT_DATA                        2352        1 
__LINKEDIT                       168.8M        9 
__OBJC_RO                         65.4M        1 
__OBJC_RW                         1985K        2 
__TEXT                           215.9M      286 
dyld private memory                256K        1 
mapped file                        4.1G     1232 
shared memory                       32K        2 
unshared pmap                     2336K        2 
===========                     =======  ======= 
TOTAL                              5.4G     2345 
TOTAL, minus reserved VM space     4.9G     2345 

-----------
Full Report
-----------

{"app_name":"Panda3D_Python3.11","timestamp":"2022-12-26 16:48:51.00 +0100","app_version":"","slice_uuid":"01b09742-24af-31d4-a96c-a20d41b5ba68","build_version":"0.0.0","platform":1,"bundleID":"","share_with_app_devs":1,"is_first_party":0,"bug_type":"309","os_version":"macOS 13.1 (22C65)","roots_installed":0,"name":"Panda3D_Python3.11","incident_id":"A5C0F114-4C07-466E-B856-2F7E0D720DD8"}
{
  "uptime" : 350000,
  "procRole" : "Background",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 210,
  "modelCode" : "MacBookPro17,1",
  "coalitionID" : 48452,
  "osVersion" : {
    "train" : "macOS 13.1",
    "build" : "22C65",
    "releaseType" : "User"
  },
  "captureTime" : "2022-12-26 16:48:49.7246 +0100",
  "incident" : "A5C0F114-4C07-466E-B856-2F7E0D720DD8",
  "pid" : 49637,
  "translated" : true,
  "cpuType" : "X86-64",
  "roots_installed" : 0,
  "bug_type" : "309",
  "procLaunch" : "2022-12-26 16:48:48.8421 +0100",
  "procStartAbsTime" : 8609283091361,
  "procExitAbsTime" : 8609304226279,
  "procName" : "Panda3D_Python3.11",
  "procPath" : "\/Users\/USER\/*\/Panda3D_Python3.11.app\/Contents\/MacOS\/Panda3D_Python3.11",
  "bundleInfo" : {"CFBundleVersion":"0.0.0","CFBundleIdentifier":""},
  "storeInfo" : {"deviceIdentifierForVendor":"C4D2D214-9E89-5057-9E4F-570601D37366","thirdParty":true},
  "parentProc" : "launchd",
  "parentPid" : 1,
  "crashReporterKey" : "57AC0780-B90F-4309-3056-AA325F7DC527",
  "throttleTimeout" : 2147483647,
  "wakeTime" : 11307,
  "sleepWakeUUID" : "2CB27338-D650-40AC-B038-14D98E577FF8",
  "sip" : "enabled",
  "vmRegionInfo" : "0x209253f8b is not in any region.  Bytes after previous region: 137518988  Bytes before following region: 4170133621\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      unused __TEXT               200f2c000-200f2e000    [    8K] r--\/r-- SM=NUL  ...ed lib __TEXT\n--->  GAP OF 0x100c19000 BYTES\n      Stack Guard                 301b47000-30534b000    [ 56.0M] ---\/rwx SM=NUL  ",
  "exception" : {"codes":"0x0000000000000001, 0x0000000209253f8b","rawCodes":[1,8743370635],"type":"EXC_BAD_ACCESS","signal":"SIGSEGV","subtype":"KERN_INVALID_ADDRESS at 0x0000000209253f8b"},
  "termination" : {"flags":1024,"code":11,"namespace":"SIGNAL","indicator":"Segmentation fault: 11","byProc":"exc handler","byPid":49637},
  "vmregioninfo" : "0x209253f8b is not in any region.  Bytes after previous region: 137518988  Bytes before following region: 4170133621\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      unused __TEXT               200f2c000-200f2e000    [    8K] r--\/r-- SM=NUL  ...ed lib __TEXT\n--->  GAP OF 0x100c19000 BYTES\n      Stack Guard                 301b47000-30534b000    [ 56.0M] ---\/rwx SM=NUL  ",
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 0,
  "threads" : [{"triggered":true,"id":8063956,"threadState":{"flavor":"x86_THREAD_STATE","rbp":{"value":12980598976},"r12":{"value":1},"rosetta":{"tmp2":{"value":140703258169120},"tmp1":{"value":4468388128},"tmp0":{"value":140705665678644}},"rbx":{"value":4448404384},"r8":{"value":227},"r15":{"value":4453689776},"r10":{"value":4447658920},"rdx":{"value":1},"rdi":{"value":4453689824},"r9":{"value":112},"r13":{"value":4453689824},"rflags":{"value":515},"rax":{"value":0},"rsp":{"value":12980598976},"r11":{"value":1},"rcx":{"value":0},"r14":{"value":12980599056},"rsi":{"value":8743370635}},"queue":"com.apple.main-thread","frames":[{"imageOffset":3957,"symbol":"_platform_strcmp","symbolLocation":85,"imageIndex":0},{"imageOffset":2197363,"symbol":"find_frozen","symbolLocation":307,"imageIndex":1},{"imageOffset":2199757,"symbol":"_imp_find_frozen","symbolLocation":125,"imageIndex":1},{"imageOffset":1082116,"symbol":"cfunction_vectorcall_FASTCALL_KEYWORDS","symbolLocation":68,"imageIndex":1},{"imageOffset":1914634,"symbol":"_PyEval_EvalFrameDefault","symbolLocation":73082,"imageIndex":1},{"imageOffset":1926800,"symbol":"_PyEval_Vector","symbolLocation":128,"imageIndex":1},{"imageOffset":676909,"symbol":"object_vacall","symbolLocation":429,"imageIndex":1},{"imageOffset":676323,"symbol":"PyObject_CallMethodObjArgs","symbolLocation":227,"imageIndex":1},{"imageOffset":2182717,"symbol":"PyImport_ImportModuleLevelObject","symbolLocation":1069,"imageIndex":1},{"imageOffset":1808415,"symbol":"builtin___import__","symbolLocation":191,"imageIndex":1},{"imageOffset":1082116,"symbol":"cfunction_vectorcall_FASTCALL_KEYWORDS","symbolLocation":68,"imageIndex":1},{"imageOffset":671608,"symbol":"_PyObject_CallFunctionVa","symbolLocation":168,"imageIndex":1},{"imageOffset":671404,"symbol":"PyObject_CallFunction","symbolLocation":156,"imageIndex":1},{"imageOffset":2180911,"symbol":"PyImport_Import","symbolLocation":335,"imageIndex":1},{"imageOffset":1931674,"symbol":"_PyCodecRegistry_Init","symbolLocation":682,"imageIndex":1},{"imageOffset":1946768,"symbol":"_PyCodec_Lookup","symbolLocation":912,"imageIndex":1},{"imageOffset":1533098,"symbol":"config_get_codec_name","symbolLocation":74,"imageIndex":1},{"imageOffset":2340712,"symbol":"init_interp_main","symbolLocation":568,"imageIndex":1},{"imageOffset":2339881,"symbol":"pyinit_main","symbolLocation":57,"imageIndex":1},{"imageOffset":2329019,"symbol":"Py_InitializeFromConfig","symbolLocation":1083,"imageIndex":1},{"imageOffset":2348310,"symbol":"Py_InitializeEx","symbolLocation":278,"imageIndex":1},{"imageOffset":9432,"symbol":"Py_FrozenMain","symbolLocation":344,"imageIndex":2},{"imageOffset":10875,"symbol":"main","symbolLocation":891,"imageIndex":2},{"imageOffset":25360,"symbol":"start","symbolLocation":2432,"imageIndex":3}]},{"id":8064004,"name":"com.apple.rosetta.exceptionserver","frames":[{"imageOffset":17940,"imageIndex":4},{"imageOffset":66864,"imageIndex":4},{"imageOffset":73520,"imageIndex":4}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 140703258165248,
    "size" : 40952,
    "uuid" : "f314b62b-98f4-3a7c-8296-8739f8b6855a",
    "path" : "\/usr\/lib\/system\/libsystem_platform.dylib",
    "name" : "libsystem_platform.dylib"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 4455084032,
    "size" : 4063232,
    "uuid" : "41aefab3-e30a-3aed-806a-ac88734a771b",
    "path" : "\/Users\/USER\/*\/Panda3D_Python3.11.app\/Contents\/Frameworks\/libpython3.11.dylib",
    "name" : "libpython3.11.dylib"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 4307652608,
    "CFBundleIdentifier" : "",
    "size" : 12288,
    "uuid" : "01b09742-24af-31d4-a96c-a20d41b5ba68",
    "path" : "\/Users\/USER\/*\/Panda3D_Python3.11.app\/Contents\/MacOS\/Panda3D_Python3.11",
    "name" : "Panda3D_Python3.11",
    "CFBundleVersion" : "0.0.0"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 8604835840,
    "size" : 622592,
    "uuid" : "bb7a0970-8c62-3dce-a7a2-5cec9c501f11",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 140703127699456,
    "size" : 196608,
    "uuid" : "d592bc4a-4a21-348f-a406-e12f9cd2f27c",
    "path" : "\/usr\/libexec\/rosetta\/runtime",
    "name" : "runtime"
  },
  {
    "size" : 0,
    "source" : "A",
    "base" : 0,
    "uuid" : "00000000-0000-0000-0000-000000000000"
  }
],
  "sharedCache" : {
  "base" : 140703254020096,
  "size" : 21474836480,
  "uuid" : "16923f88-e9fc-38d2-947c-df242e486636"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=384.7M resident=0K(0%) swapped_out_or_unallocated=384.7M(100%)\nWritable regions: Total=815.9M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=815.9M(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nKernel Alloc Once                    8K        1 \nMALLOC                           154.1M       14 \nMALLOC guard page                   96K        4 \nMALLOC_MEDIUM (reserved)         120.0M        1         reserved VM address space (unallocated)\nMALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)\nRosetta Arena                     4096K        2 \nRosetta Generic                    980K      242 \nRosetta IndirectBranch              96K        2 \nRosetta JIT                      128.0M        1 \nRosetta Return Stack                20K        2 \nRosetta Thread Context              20K        2 \nStack                             8176K        1 \nStack Guard                       56.0M        1 \nVM_ALLOCATE                       14.2M       10 \n__DATA                            15.8M      266 \n__DATA_CONST                      13.1M      163 \n__DATA_DIRTY                       632K       96 \n__FONT_DATA                        2352        1 \n__LINKEDIT                       168.8M        9 \n__OBJC_RO                         65.4M        1 \n__OBJC_RW                         1985K        2 \n__TEXT                           215.9M      286 \ndyld private memory                256K        1 \nmapped file                        4.1G     1232 \nshared memory                       32K        2 \nunshared pmap                     2336K        2 \n===========                     =======  ======= \nTOTAL                              5.4G     2345 \nTOTAL, minus reserved VM space     4.9G     2345 \n",
  "legacyInfo" : {
  "threadTriggered" : {
    "queue" : "com.apple.main-thread"
  }
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "5ffde50ce2aacd000d47a95f",
      "factorPackIds" : {

      },
      "deploymentId" : 240000234
    },
    {
      "rolloutId" : "6347054113acce15305b7b82",
      "factorPackIds" : {
        "SIRI_MEMORY_SYNC_CONFIG" : "634705e78e8be655c1316a6e"
      },
      "deploymentId" : 240000005
    }
  ],
  "experiments" : [

  ]
}
}

Model: MacBookPro17,1, BootROM 8419.60.44, proc 8:4:4 processors, 16 GB, SMC 
Graphics: Apple M1, Apple M1, Built-In
Display: Color LCD, 2560 x 1600 Retina, Main, MirrorOff, Online
Display: DELL U2719D, 2560 x 1440 (QHD/WQHD - Wide Quad High Definition), MirrorOff, Online
Memory Module: LPDDR4, Hynix
AirPort: spairport_wireless_card_type_wifi (0x14E4, 0x4378), wl0: Sep  3 2022 03:37:22 version 18.20.379.4.7.8.143 FWID 01-e3c71b50
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: USB 10/100/1000 LAN 5, Ethernet, en14
Network Service: Wi-Fi, AirPort, en0
USB Device: USB31Bus
USB Device: USB31Bus
USB Device: USB3.0 Hub
USB Device: hub_device
USB Device: USB 10/100/1000 LAN
USB Device: My Passport 0748
USB Device: USB2.0 Hub
USB Device: hub_device
USB Device: composite_device
USB Device: USB 2.0 Hub
USB Device: USB Billboard Device
Thunderbolt Bus: MacBook Pro, Apple Inc.
Thunderbolt Bus: MacBook Pro, Apple Inc.

Any help in solving the above problem will be appreciated. Thanks in advance.

rdb commented 1 year ago

Can confirm that this also fails on Linux. It looks like there were some changes to the frozen module import mechanism in Python 3.11, such as python/cpython#28778 - it looks like a change that is actually very useful for us but I have to review the implications.

rdb commented 1 year ago

Actually, it's due to two changes made to the _frozen struct in Python 3.11, one of which undocumented.

For now I'm going to fix this by modifying deploy-stub to copy and transform it to a new structure, so that I can hot-fix this by uploading new wheels so that nobody has to update their version of Panda.

Making use of the other changes to the frozen import mechanism sounds like a good idea for a future version of Panda.

rdb commented 1 year ago

I think this is fixed, I uploaded updated wheels, can you delete your build directory and try again? You don't need to update your version of Panda3D on the host. Please verify that see something like "1.10.13+post1" in the message about which .whl gets downloaded by the build_apps command.

miklesz commented 1 year ago

I hereby confirm that the fix works. After deleting the previous wheels, the new ones (with 1.10.13+post1 in the name) were downloaded and the Python 3.11 build works without problems (on macOS). Thank you for your support!