Deploying your game. How do you go from github repo to an installable package?

I have an open source panda3d project in this github repo. By following the install instructions in the README, one can play the game by typing pooltool in the terminal/command prompt.

Yet how can I graduate from this rather hacky installation to something more user friendly, i.e. downloading an installer, opening it up, clicking next next next next, and then an icon appears in your applications directory.

Does anyone have guidance for pulling this off? Thanks in advance.

Look at the example with asteroids, it shows how to do this.

https://docs.panda3d.org/1.10/python/distribution/index

Accordingly, when you get the binary files of the game, you can create an installer using any tool. For example, for Windows, you can use NSIS.

Thanks for the reference source. This is great.

Although I am running into an error during python setup.py build_apps that I find quite confusing.

The issue is that my requirements.txt looks like this:

β–Άβ–Ά cat requirements.txt
numpy
psutil
scipy
pandas
panda3d
colored
pyquaternion

But running setuptools fails at this step:

β–Άβ–Ά python setup.py build_apps
running build_apps
Building platforms: manylinux1_x86_64,macosx_10_9_x86_64,win_amd64
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 numpy
  Using cached numpy-1.20.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (13.7 MB)
ERROR: Could not find a version that satisfies the requirement psutil
ERROR: No matching distribution found for psutil
Traceback (most recent call last):
  File "setup.py", line 5, in <module>
    setup(
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/site-packages/direct/dist/commands.py", line 442, in run
    self.build_runtimes(platform, True)
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/site-packages/direct/dist/commands.py", line 593, in build_runtimes
    wheelpaths = self.download_wheels(platform)
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/site-packages/direct/dist/commands.py", line 497, in download_wheels
    subprocess.check_call([sys.executable, '-m', 'pip'] + pip_args)
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Users/evan/anaconda3/envs/pooltool/bin/python', '-m', 'pip', '--disable-pip-version-check', 'download', '-d', '/Users/evan/Software/pooltool/build/__whl_cache__/manylinux1_x86_64_cp38', '-r', '/Users/evan/Software/pooltool/requirements.txt', '--only-binary', ':all:', '--platform', 'manylinux1_x86_64', '--abi', 'cp38', '--extra-index-url', 'https://archive.panda3d.org/simple/opt', '--extra-index-url', 'https://archive.panda3d.org/thirdparty']' returned non-zero exit status 1.

The strange part is that I can uninstall and reinstall psutil with no problem using pip:

β–Άβ–Ά which python
/Users/evan/anaconda3/envs/pooltool/bin/python
β–Άβ–Ά which pip
/Users/evan/anaconda3/envs/pooltool/bin/pip
β–Άβ–Ά pip install psutil
Collecting psutil
  Downloading psutil-5.8.0-cp38-cp38-macosx_10_9_x86_64.whl (236 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 236 kB 3.5 MB/s
Installing collected packages: psutil
Successfully installed psutil-5.8.0

I think that whatever wrapper panda3d has built around setuptools may be fumbling this. Any ideas?

In fact, you have the wrong idea that this is a panda system, Setuptools is a third-party package.

You can test this in a separate program without panda.

I need to correct that: while setuptools is a generic build system, the build_apps command and its options are a Panda-specific tools.

1 Like

In fact, you have the wrong idea that this is a panda system, Setuptools is a third-party package.

Setuptools is a third-party package, but from my understanding, panda3d is not using any ordinary version of setuptools. build_apps isn’t a vanilla setuptools run command.

When building for Linux, Panda defaults to the manylinux1_x86_64 platform tag. However, psutil does not make wheels available for this tag. It does have them for a newer version of manylinux, namely 2010, which is backward compatible.

So you can add this to setup.py build_apps options to use the newer tag:

"platforms": ["win_amd64", "manylinux2010_x86_64", "macosx_10_9_x86_64"],

If this is the case, then there will be constant problems with it. If you consider the large number of packages.

Thanks for the quick reply. This definitely fixed that problem, however the same thing has happened for the package colored. Could you please explain how I could found out which tags are available for colored, the way you’ve done for psutil? For reference, here is colored's project page.

I think there is a more pressing issue though. For the sake of moving forward, I removed colored from requirements.txt and received this error:

β–Ά python setup.py build_apps
running build_apps
Building platforms: win_amd64,manylinux2010_x86_64,macosx_10_9_x86_64
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 numpy
  Using cached numpy-1.20.3-cp38-cp38-win_amd64.whl (13.7 MB)
Collecting psutil
  Using cached psutil-5.8.0-cp38-cp38-win_amd64.whl (245 kB)
Collecting scipy
  Using cached scipy-1.6.3-cp38-cp38-win_amd64.whl (32.7 MB)
Collecting pandas
  Using cached pandas-1.2.4-cp38-cp38-win_amd64.whl (9.3 MB)
Collecting panda3d
  Using cached https://buildbot.panda3d.org/downloads/v1.10.9/opt/panda3d-1.10.9%2Bopt-cp38-cp38-win_amd64.whl (64.8 MB)
Collecting pyquaternion
  Using cached pyquaternion-0.9.9-py3-none-any.whl (14 kB)
Collecting python-dateutil>=2.7.3
  Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting pytz>=2017.3
  Using cached pytz-2021.1-py2.py3-none-any.whl (510 kB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Saved ./build/__whl_cache__/win_amd64_cp38/numpy-1.20.3-cp38-cp38-win_amd64.whl
Saved ./build/__whl_cache__/win_amd64_cp38/panda3d-1.10.9+opt-cp38-cp38-win_amd64.whl
Saved ./build/__whl_cache__/win_amd64_cp38/pandas-1.2.4-cp38-cp38-win_amd64.whl
Saved ./build/__whl_cache__/win_amd64_cp38/python_dateutil-2.8.1-py2.py3-none-any.whl
Saved ./build/__whl_cache__/win_amd64_cp38/pytz-2021.1-py2.py3-none-any.whl
Saved ./build/__whl_cache__/win_amd64_cp38/six-1.16.0-py2.py3-none-any.whl
Saved ./build/__whl_cache__/win_amd64_cp38/psutil-5.8.0-cp38-cp38-win_amd64.whl
Saved ./build/__whl_cache__/win_amd64_cp38/pyquaternion-0.9.9-py3-none-any.whl
Saved ./build/__whl_cache__/win_amd64_cp38/scipy-1.6.3-cp38-cp38-win_amd64.whl
Successfully downloaded numpy panda3d pandas python-dateutil pytz six psutil pyquaternion scipy
Building runtime for platform: win_amd64
Traceback (most recent call last):
  File "setup.py", line 5, in <module>
    setup(
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/site-packages/direct/dist/commands.py", line 442, in run
    self.build_runtimes(platform, True)
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/site-packages/direct/dist/commands.py", line 829, in build_runtimes
    create_runtime(appname, scriptname, False)
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/site-packages/direct/dist/commands.py", line 762, in create_runtime
    freezer.done(addStartupModules=True)
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/site-packages/direct/dist/FreezeTool.py", line 1186, in done
    self.__loadModule(self.ModuleDef(modname, implicit = True))
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/site-packages/direct/dist/FreezeTool.py", line 1272, in __loadModule
    self.mf.import_hook(mdef.moduleName)
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/modulefinder.py", line 175, in import_hook
    q, tail = self.find_head_package(parent, name)
  File "/Users/evan/anaconda3/envs/pooltool/lib/python3.8/modulefinder.py", line 243, in find_head_package
    raise ImportError("No module named " + qname)
ImportError: No module named cmath

Do you have any recommendations?