Need help with .exe making

How did you install panda?

Yes, that is correct.

Please ignore the warning about the fmod plugin, it is normal and does not indicate an error in your installation or code.

I have created an empty application and I am getting this error too.

Although the asteroid app is build and working. :thinking:
I just now noticed that this is related for Mac. It turns out that Fmod cannot be used under Mac. What’s strange going on with Panda3D.

@2ant
Try this.
tetsgame.zip (1.1 KB)
In the bat file, change the python location address to yours, or use a variable.
If you run it, the log file will be in the root of the folder.

I forgot to say that you need to edit the log file save path as well.

I uninstalled all the Python and Pycharm files and downloaded the panda3D installer.
I built asteroids throught windows command line and it worked.
After that i installed pycharm and set it up to use the python from the panda3D install directory.
Everything works, just have to learn Python and Panda3D now.

Thank you@rdb and @serega-kkz for the help.

Let me revive this thread …
I am struggling with a similar problem and I have the impression that it only affects Python 3.10, NOT earlier versions.
To isolate the problem, I am building an ‘asteroids’ application for the ‘manylinux2010_x86_64’, ‘macosx_10_9_x86_64’, and ‘win_amd64’ platforms.
I do this on macOS Monterey, Version 12.2, Apple M1.
I am using the latest versions of Python, downloaded from https://www.python.org: 3.10.2 and 3.9.10. I enforce intel64 version every time.
I do not know if the ‘manylinux2010_x86_64’ application starts correctly, because I do not have such a machine at hand to check it. But it is not relevant at the moment.
The ‘macosx_10_9_x86_64’ application starts up without any problems.
Problems arise with the ‘win_amd64’ application. While everything is OK with Python 3.9.10, then with 3.10.2 the application does not start and I get the following output.log:

Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
  File "importlib._bootstrap", line 1027, in _find_and_load
  File "importlib._bootstrap", line 1006, in _find_and_load_unlocked
  File "importlib._bootstrap", line 688, in _load_unlocked
  File "importlib._bootstrap", line 856, in exec_module
  File "site", line 9, in <module>
  File "importlib._bootstrap", line 1027, in _find_and_load
  File "importlib._bootstrap", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named '_bootlocale'

As you can see, it is about:

ModuleNotFoundError: No module named '_bootlocale'

To make sure that the problem does not apply to specific Python instances, I also tested other distributions, such as Python 3.10 from Homebrew (same problem) and Python 3.9 from Anaconda (all OK).
I attach logs of the process from building the application (to save space, I limited myself to the problematic ‘win_amd64’ platform).
Python 3.9.10:

(base) miklesz@MacBook-Pro asteroids % /Library/Frameworks/Python.framework/Versions/3.9/bin/python3-intel64 setup.py build_apps
running build_apps
Building platforms: win_amd64
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
  Using cached https://buildbot.panda3d.org/downloads/v1.10.11/opt/panda3d-1.10.11%2Bopt-cp39-cp39-win_amd64.whl (65.6 MB)
Saved ./build/__whl_cache__/win_amd64_cp39/panda3d-1.10.11+opt-cp39-cp39-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', '_heapq', '_md5', '_multibytecodec', '_opcode', '_pickle', '_posixsubprocess', '_random', '_sha1', '_sha256', '_sha3', '_sha512', '_statistics', '_struct', 'binascii', 'grp', 'math', 'zlib']
warning: build_apps: could not find dependency api-ms-win-core-path-l1-1-0.dll (referenced by python39.dll)

Copying game files for platform: win_amd64

Writing /Users/miklesz/PycharmProjects/PointCloud/asteroids/build/win_amd64/models/plane.egg.bam
(base) miklesz@MacBook-Pro asteroids % 

Python 3.10.2:

(base) miklesz@MacBook-Pro asteroids % /Library/Frameworks/Python.framework/Versions/3.10/bin/python3-intel64 setup.py build_apps
running build_apps
Looking in indexes: https://pypi.org/simple, https://archive.panda3d.org/simple/opt, https://archive.panda3d.org/thirdparty
warning: missing-index-doctype

× The package index page being used does not have a proper HTML doctype declaration.
╰─> Problematic URL: https://archive.panda3d.org/simple/opt/panda3d/

note: This is an issue with the page at the URL mentioned above.
hint: You might need to reach out to the owner of that package index, to get this fixed. See https://github.com/pypa/pip/issues/10825 for context.
warning: missing-index-doctype

× The package index page being used does not have a proper HTML doctype declaration.
╰─> Problematic URL: https://archive.panda3d.org/thirdparty/panda3d/

note: This is an issue with the page at the URL mentioned above.
hint: You might need to reach out to the owner of that package index, to get this fixed. See https://github.com/pypa/pip/issues/10825 for context.
Collecting panda3d
  Using cached https://buildbot.panda3d.org/downloads/v1.10.11/opt/panda3d-1.10.11%2Bopt-cp310-cp310-win_amd64.whl (65.5 MB)
Saved ./build/__whl_cache__/win_amd64_cp310/panda3d-1.10.11+opt-cp310-cp310-win_amd64.whl
Successfully downloaded panda3d
There are some missing modules: ['_bisect', '_blake2', '_bootlocale', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_contextvars', '_heapq', '_md5', '_multibytecodec', '_opcode', '_pickle', '_posixsubprocess', '_random', '_sha1', '_sha256', '_sha3', '_sha512', '_statistics', '_struct', 'binascii', 'grp', 'math', 'zlib']
warning: build_apps: could not find dependency api-ms-win-core-path-l1-1-0.dll (referenced by python310.dll)


Writing /Users/miklesz/PycharmProjects/PointCloud/asteroids/build/win_amd64/models/plane.egg.bam
(base) miklesz@MacBook-Pro asteroids % 

As you can see, in the case of Python 3.10 it actually shows up in addition:

'_bootlocale'

on list:

There are some missing modules:

Anyone have any ideas? I just want to use Python 3.10 due to the availability of Structural Pattern Matching (match-case).

I’ll fix this in the next version of Panda3D.

In the meantime, edit dist/commands.py, find this bit:

if sys.platform == 'win32':
    # Make sure the preferred encoding is something we actually support.
    import _bootlocale
    enc = _bootlocale.getpreferredencoding().lower()
    if enc != 'utf-8' and not _imp.is_frozen('encodings.%s' % (enc)):
        def getpreferredencoding(do_setlocale=True):
            return 'mbcs'
        _bootlocale.getpreferredencoding = getpreferredencoding

Replace it with this:

if sys.platform == 'win32':
    # Make sure the preferred encoding is something we actually support.
    _bootlocale = sys.modules.get('_bootlocale')
    if _bootlocale:
        enc = _bootlocale.getpreferredencoding().lower()
        if enc != 'utf-8' and not _imp.is_frozen('encodings.%s' % (enc)):
            def getpreferredencoding(do_setlocale=True):
                return 'mbcs'
            _bootlocale.getpreferredencoding = getpreferredencoding