indygreg / indygreg/PyOxidizer

PyOxidizer unable to build exectuables using pygame module

Open
#145 2 comments 1 reaction 0 assignees View on GitHub
compatibility
Dominant language
Rust
Stars
6.2k
Forks
256
PR merge metrics
No merged PRs in 30d

Description

As per the title. I'd read good things about the speed of pyOxidiser executables vs PyInstaller so I thought it might make a good replacement when making game executables for distribution via platforms like steam.

Unfortunately, while I was able to build a basic python app following all the instructions, when I try including pygame in the toml file I get an error like this:

```
Collecting pygame
Downloading https://files.pythonhosted.org/packages/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441db2be/pygame-1.9.6.tar.gz (3.2MB)
ERROR: Command errored out with exit status 1:
command: 'C:\Users\USERNAME\Desktop\pyOxidizerTest\pygame_app\build\target\x86_64-pc-windows-msvc\debug\pyoxidizer\python.82ae15f31178\python\install\python.e
xe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USERNAME\\AppData\\Local\\Temp\\pip-install-b2y0v2y4\\pygame\\setup.py'"'"'; __file__='"'"'
C:\\Users\\USERNAME\\AppData\\Local\\Temp\\pip-install-b2y0v2y4\\pygame\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"
'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: C:\Users\USERNAME\AppData\Local\Temp\pip-install-b2y0v2y4\pygame\
Complete output (17 lines):


WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...


Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x64"? [Y/n]Traceback (most recent call last):
File "", line 1, in
File "C:\Users\USERNAME\AppData\Local\Temp\pip-install-b2y0v2y4\pygame\setup.py", line 194, in
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\USERNAME\AppData\Local\Temp\pip-install-b2y0v2y4\pygame\buildconfig\config.py", line 210, in main
deps = CFG.main(**kwds)
File "C:\Users\USERNAME\AppData\Local\Temp\pip-install-b2y0v2y4\pygame\buildconfig\config_win.py", line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\Users\USERNAME\AppData\Local\Temp\pip-install-b2y0v2y4\pygame\buildconfig\download_win_prebuilt.py", line 303, in ask
'\nDownload prebuilts to "%s" and copy to %s? [Y/n]' % (download_dir, dest_str))
EOFError: EOF when reading a line
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
thread 'main' panicked at 'error running pip', C:\Users\USERNAME\.cargo\registry\src\github.com-1ecc6299db9ec823\pyoxidizer-0.3.0\src\pyrepackager\packaging_rule.r
s:889:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
```

the lines I added to the auto generated .toml file:
```
[[packaging_rule]]
type = "pip-install-simple"
package = "pygame"

mode = "module"
module = "src.window_test.__main__"
```

And this was the simple program I was trying to package:

```
import pygame

class WindowTestApp:
def __init__(self):
pygame.init()

self.window_surface = pygame.display.set_mode((800, 600))

self.running = True

def run(self):
while self.running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
self.running = False

pygame.display.flip()

if __name__ == "__main__":
app = WindowTestApp()
app.run()

```

Is chucking your program's python files into the generated src directory the intended path to packaging an application as I have done here? The 'getting started' documentation seems to focus on packaging a module downloaded from pypi which seems like a much rarer use case to my mind.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure with the generated TOML, the pip-install-simple rule for pygame, and the src.window_test.__main__ entry point. Read the pygame setup.py output and the failure location in packaging_rule.rs:889:9, then review the getting-started documentation. Done means the reported application packaging path and the pygame build behavior are clarified or fixed and verified with this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
build-system, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.