Building asteroids with deploy-ng fails on Linux

I am trying to build the asteroids demo on Ubuntu 17.10 with deploy-ng. I am using the latest version of panda3d from the deploy-ng branch, installed with pip. I ran the setup.py in the asteroids demo with:

python3 setup.py build_apps

Which gives the following output:

running build_apps
Building platforms: manylinux1_x86_64,macosx_10_6_x86_64,win32,win_amd64
Gathering wheels for platform: manylinux1_x86_64
Collecting panda3d (from -r ./requirements.txt (line 2))
  File was already downloaded /home/hpoggie/bin/panda3d/samples/asteroids/build/__whl_cache__/panda3d-1.10.0.dev1437+deployng.190-cp36-cp36m-manylinux1_x86_64.whl
Successfully downloaded panda3d
Building runtime for platform: manylinux1_x86_64
There are some missing modules: ['__builtin__', '_winapi']
WARNING: Could not find blob header. Is deploy-stub outdated?
Copying game files for platform: manylinux1_x86_64

Writing /home/hpoggie/bin/panda3d/samples/asteroids/build/manylinux1_x86_64/models/plane.egg.bam
Gathering wheels for platform: macosx_10_6_x86_64
Collecting panda3d (from -r ./requirements.txt (line 2))
  File was already downloaded /home/hpoggie/bin/panda3d/samples/asteroids/build/__whl_cache__/panda3d-1.10.0.dev1437+deployng.190-cp36-cp36m-macosx_10_6_x86_64.whl
Successfully downloaded panda3d
Building runtime for platform: macosx_10_6_x86_64
There are some missing modules: ['_opcode']
Traceback (most recent call last):
  File "setup.py", line 23, in <module>
    'win_amd64',
  File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.6/dist-packages/direct/showutil/dist.py", line 164, in run
    self.build_runtimes(platform, use_wheels)
  File "/usr/local/lib/python3.6/dist-packages/direct/showutil/dist.py", line 405, in build_runtimes
    create_runtime(appname, scriptname, False)
  File "/usr/local/lib/python3.6/dist-packages/direct/showutil/dist.py", line 369, in create_runtime
    stub_file = p3dwhl.open('panda3d_tools/{0}'.format(stub_name))
  File "/usr/lib/python3.6/zipfile.py", line 1352, in open
    zinfo = self.getinfo(name)
  File "/usr/lib/python3.6/zipfile.py", line 1281, in getinfo
    'There is no item named %r in the archive' % name)
KeyError: "There is no item named 'panda3d_tools/deploy-stubw' in the archive"

When I try to run the executable, it fails with this output:

Fatal Python error: __main__ not frozen
[1]    16155 abort (core dumped)  ./asteroids

This is confusing. The error messages suggest that it’s somehow using very out-of-date versions of the panda3d wheel, but then it does claim that it downloaded dev.1437+deployng.190, which should contain these files; I just successfully built with them, too.

Could it somehow be using another cached .whl file from somewhere? Could you try completely deleting the build directory? Perhaps you could additionally try deleting the ~/.cache/pip directory?

Removing the build directory fixed it.