Need help with .exe making

Hello, i use pycharm and i ran the code from this page just fine : Using Intervals to move the Panda — Panda3D Manual

But when i try to run an executable made with “pyinstaller --onefile -w main.py”
I got this

I tried to put this in config.prc :

load-display pandagl
aux-display pandadx9
aux-display p3tinydisplay

If i take out the -w and rebuild it runs but it closes immediately

I am very new with everything python related so i can’t solve this on my own.

Thanks for your time

It’s not that simple, panda contains binary files of modules and plugins. Which should also be placed in your application with configured paths.

Therefore, this path is recommended.

https://docs.panda3d.org/1.10/python/distribution/index#distributing-panda3d-applications

1 Like

Thank you, i will look into it.

I followed the link and got 2 build : win32 and winamd64 but they both close immediately.

Try sample build: Asteroids.

https://docs.panda3d.org/1.10/python/distribution/setuptools-examples#asteroids-sample

To do this, check the folder.

Panda3D-1.10.10-x64\samples\asteroids

If you used pip to install panda, you can download them from the link.

Just did, same result.

C:\Users\antoi\Downloads\panda3d-1.10.10-samples\panda3d-1.10.10\samples\asteroids>python setup.py bdist_apps
running bdist_apps
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
  Using cached https://buildbot.panda3d.org/downloads/v1.10.10/opt/panda3d-1.10.10%2Bopt-cp310-cp310-manylinux2010_x86_64.whl (54.3 MB)
Saved c:\users\antoi\downloads\panda3d-1.10.10-samples\panda3d-1.10.10\samples\asteroids\build\__whl_cache__\manylinux2010_x86_64_cp310\panda3d-1.10.10+opt-cp310-cp310-manylinux2010_x86_64.whl
Successfully downloaded panda3d
Building runtime for platform: manylinux2010_x86_64
There are some missing modules: ['__builtin__', '_bootlocale']
Copying game files for platform: manylinux2010_x86_64

Writing /c/Users/antoi/Downloads/panda3d-1.10.10-samples/panda3d-1.10.10/samples/asteroids/build/manylinux2010_x86_64/models/plane.egg.bam
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
  Using cached https://buildbot.panda3d.org/downloads/v1.10.10/opt/panda3d-1.10.10%2Bopt-cp310-cp310-macosx_10_9_x86_64.whl (64.5 MB)
Saved c:\users\antoi\downloads\panda3d-1.10.10-samples\panda3d-1.10.10\samples\asteroids\build\__whl_cache__\macosx_10_9_x86_64_cp310\panda3d-1.10.10+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

Writing /c/Users/antoi/Downloads/panda3d-1.10.10-samples/panda3d-1.10.10/samples/asteroids/build/macosx_10_9_x86_64/models/plane.egg.bam
Bundling macOS app into C:\Users\antoi\Downloads\panda3d-1.10.10-samples\panda3d-1.10.10\samples\asteroids\build\macosx_10_9_x86_64\asteroids.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
  Using cached https://buildbot.panda3d.org/downloads/v1.10.10/opt/panda3d-1.10.10%2Bopt-cp310-cp310-win_amd64.whl (64.9 MB)
Saved c:\users\antoi\downloads\panda3d-1.10.10-samples\panda3d-1.10.10\samples\asteroids\build\__whl_cache__\win_amd64_cp310\panda3d-1.10.10+opt-cp310-cp310-win_amd64.whl
Successfully downloaded panda3d
Building runtime for platform: win_amd64
There are some missing modules: ['_posixsubprocess', 'grp']
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

Writing /c/Users/antoi/Downloads/panda3d-1.10.10-samples/panda3d-1.10.10/samples/asteroids/build/win_amd64/models/plane.egg.bam

Building gztar for platform: manylinux2010_x86_64

Building zip for platform: macosx_10_9_x86_64

Building zip for platform: win_amd64

C:\Users\antoi\Downloads\panda3d-1.10.10-samples\panda3d-1.10.10\samples\asteroids>python setup.py bdist_apps

Correction : i don’t even see a console appear and disappear.

What is in the contents of the log file? You did specify a log_filename in your setup.py, right?

Nope, how can i do that ?

The Asteroids sample has an example setup.py that shows how to specify a log_filename. The resulting log will be in your user appdata directory.

More information here:

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'

warning: build_apps: Missing audio plugin p3fmod_audio referenced in PRC data, replacing with p3openal_audio

How did it turn out in the asteroids example?

I don’t understand what you mean. I just ran “python setup.py bdist_apps” and copy/pasted the result

You have downloaded the sample!?
Build a sample asteroids in panda.

Yes i did, look at the sixth message in this thread.

plugin p3fmod_audio

You see, this plugin is not specified in asteroids.

You’ve changed something. Just don’t do anything with the setup file and build this example.

i didn’t change the setup file of the asteroids sample :

from setuptools import setup

setup(
    name="asteroids",
    options = {
        'build_apps': {
            'include_patterns': [
                '**/*.png',
                '**/*.jpg',
                '**/*.egg',
            ],
            'gui_apps': {
                'asteroids': 'main.py',
            },
            'log_filename': '$USER_APPDATA/Asteroids/output.log',
            'log_append': False,
            'plugins': [
                'pandagl',
                'p3openal_audio',
            ],
        }
    }
)

Should i uninstall pycharm,python and redo everything from scratch ?

Why do you keep bringing up the fmod plugin? It has clearly nothing to do with the issue of being unable to start up the game.

@2ant The error is rather strange, I’m not sure that I’ve ever seen it before. However, I think it might be due to the fact that you have more than one version of Python installed. Try running setup.py with ppython instead of python, to ensure you are using Panda’s copy of Python.

Because it is important to make sure that the minimum example works. I’m not going to do telepathy.

Am i supposed to write it like this ? C:\Users\antoi\Downloads\panda3d-1.10.10-samples\panda3d-1.10.10\samples\asteroids>ppython setup.py bdist_apps