Hello world app build not working

Good afternoon, ladies and gentlemen.

I used to not be the kind to ask for help, but if this will speed up my game project development I shall do so from now on. I was experimenting with a panda3d feature which the engine I previously used (and no longer exists) did not had and will help me a lot: setuptools

I created a very simple “Hello world” program:

print("Hello world")

For the setup.py I did:

from setuptools import setup

setup(
	name = "helloworld",
	options = {
		'build_apps':{
			'console_apps': {
				'helloworld': 'main.py',
			},
			'platforms': [
				'manylinux1_x86_64',
			],
		}
	}
)

For now I left the requisites.txt file empty, but I too tried putting “panda3d”.

At the linux terminal I did:

python setup.py build_apps

The result was (at the panda3d case):

running build_apps
Building platforms: manylinux1_x86_64
Gathering wheels for platform: manylinux1_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/90fb31ac219f7fb5e314686fed03cb069ef81554/opt/panda3d-1.10.8.post4%2Bopt-cp39-cp39-manylinux1_x86_64.whl (51.2 MB)
  Saved ./build/__whl_cache__/manylinux1_x86_64_cp39/panda3d-1.10.8.post4+opt-cp39-cp39-manylinux1_x86_64.whl
Successfully downloaded panda3d
Building runtime for platform: manylinux1_x86_64
There are some missing modules: ['_winapi', 'pep517']
Copying game files for platform: manylinux1_x86_64

I saw that part mentioning “missing modules” but I decided to test the produced executable anyway. It did not started and the output at the terminal was:

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 1007, in _find_and_load
  File "importlib._bootstrap", line 986, in _find_and_load_unlocked
  File "importlib._bootstrap", line 680, in _load_unlocked
  File "importlib._bootstrap", line 838, in exec_module
  File "site", line 34, in <module>
  File "importlib._bootstrap", line 1007, in _find_and_load
  File "importlib._bootstrap", line 986, in _find_and_load_unlocked
  File "importlib._bootstrap", line 680, in _load_unlocked
  File "importlib._bootstrap", line 838, in exec_module
  File "os", line 29, in <module>
  File "importlib._bootstrap", line 1007, in _find_and_load
  File "importlib._bootstrap", line 986, in _find_and_load_unlocked
  File "importlib._bootstrap", line 680, in _load_unlocked
  File "importlib._bootstrap", line 838, in exec_module
  File "_collections_abc", line 416, in <module>
TypeError: type 'types.GenericAlias' is not an acceptable base type

I did just in case:

pip install pep517

Then the list of missing modules increased a considerably, and it also said numpy and uuid should be put as requisites for building. I put numpy at the “requisites.txt” file, and although the numpy missing specific warning dissapeared, there was still modules missing with “numpy” on their name (not to mention other kinds of modules like zip).

Building the panda3d “asteroids” sample give the same issues (do not start), the difference is I got no error output as it was redirect to a file in a place I do not know in my linux system. It (and the hello world test) did worked by running directly the main.py (without building). My linux system is fedora 33 workstation 64 bit, and I installed the current panda3d version by means of pip as said at the download page.

Although it will not stop my game development, I cannot distribute it to the players for testing until I solve this simple build test. I saw no topics with a issue like mine in google, most were missing its graphics plugin and had graphics related errors, but my test only requires the terminal for now. Usually when I find nothing, the issue is or software side bug (linux distribution, panda3d, etc) or is a very simple error to solve and I am being “dumb”.

I did coded in the far past for my game a simple python “build tool” which just selected, copied and pasted dlls, libraries and such in a end user folder for the platform I typed at terminal, but I am not used to work with more advanced build tools from others.

Thanks for your support regarding building a simple test app.

Hmm…

I tried your program and setup.py on my end (also Linux, albeit Ubuntu 18.04.5).

I likewise got a warning about “_winapi”, but I suspect that it’s harmless. I didn’t get one for “pep517”, but perhaps I have it already installed.

I did have to include “panda3d” in my “requirements.txt”.

However, all that done, the program built correctly and ran from a terminal as expected.

As a result, I wonder whether it’s not perhaps an incompatibility between setuptools and your system. Perhaps an issue with your Python version?

1 Like

This looks like it might be an incompatibility between the version of Python 3.9 that was used to build Panda and the version of the standard Python library that is on your system.

Could you let me know which operating system you are using, so that I can try to reproduce this issue?

The pep517 issue will be fixed in the next version of Panda3D, which will be released within the next few days. It is caused by a change in the Python standard library that makes it depend on an external library which pulls in many dependencies, including numpy.

A workaround for now might be to use Python 3.8 instead of 3.9. Using Python 3.8 has the advantage that the Windows version of your game will be able to run on Windows 7, since Python 3.9 requires at least Windows 8.1.

1 Like

I do think it is the issue Mr. Thaumaturge.

Good night,

Oh, so it is an issue bigger than me after all. I tested installing other panda3d versions with pip, but it can only install the two more recent ones if I recall right. I then tried to build just with python all last 10 versions of panda3d from source myself, and exactly around the two more recent ones only could be built. I received the same errors from the current one and the past release had another error relating to HTTP coming from one of panda modules.

Since I cannot change my system standard python because other installed apps might be using the standard version for it, I shall wait for a fix for that; that will not stop my game development, just distribution.

Just in case, I will see if setuptools can use a different panda3d version just for my game build (not a system install). I could use a virtual enviroment like virtualbox but it would be more work than just be able to do it in my real system. Equally cumbersome would be to unpack python 3.8 to a folder and point makepanda to that.

@rdb , the python version for my system according to “python --version” is: Python 3.9.2

My kernel according to “uname -r” is: 5.10.23-200.fc33.x86_64

In more details: I use Fedora 33 workstation 64 bit, gnome 3.38.4 under X11 (not wayland)

The system is always using the latest updates.

If you need more details to solve this issue which 1 year in the future will block my game project progress, let me know.

Thanks both for your support.

You can always point setuptools to an older version of Panda3D by adding a specific version specifier to your requirements.txt. But I am confident we’ll have fixed this issue between now and a year from now. :slight_smile:

There is a workaround that can be applied by editing the _collections_abc.py module on your system, if other solutions fail. I don’t remember it off the top of my head, but I think we won’t need it after I release Panda3D 1.10.9 in a couple of days.

1 Like

If you want to use Python 3.8, pyenv can be used to easily manage multiple Python versions without affecting your system Python.

2 Likes

I believe this should be resolved now if you set your requirements.txt to pick up panda3d~=1.10.9 (you may need to delete the “build” directory first).

2 Likes

@rdb

Ah, thank you sir; it is working now. I received as a welcome gift that bug, but it was quickly fixed.

Now I can distribute my game development versions to its followers for the first time in years (as the BGE did not had that feature). In addition, I learned more about setuptools and versions; and thanks to @Moguri I also now know about pyenv, so I can make game versions using older versions of python by two different methods if in the future I desire to cover older hardware (like you suggested).