8000 Packages Not Loading When Using type="py-game" · Issue #2304 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content
Packages Not Loading When Using type="py-game" #2304
Closed
@danyeaw

Description

@danyeaw

Checklist

  • I added a descriptive title
  • I searched for other issues and couldn't find a solution or duplication
  • I already searched in Google and didn't find any good information or help

What happened?

When using <script type="py-game">, packages specified in the configuration are not being installed/loaded properly, despite working correctly with <script type="py">. This appears to affect all non-standard library packages when using the PyGame integration.

What browsers are you seeing the problem on? (if applicable)

Firefox

Console info

ModuleNotFoundError: No module named 'numpy'
The module 'numpy' is included in the Pyodide distribution, but it is not installed.
You can install it by calling:
  await micropip.install("numpy") in Python, or
  await pyodide.loadPackage("numpy") in JavaScript

Additional Context

What Works / What Doesn't

  • ✅ Standard library packages work fine with both script types
  • ✅ External packages work correctly when using <script type="py">
  • ❌ External packages fail to load when using <script type="py-game">
  • ❌ The issue occurs with any external package (numpy, httpx, etc.)

Steps to Reproduce

  1. Create a simple HTML file with a PyGame script that imports an external package
  2. Configure the package in TOML: packages = ["numpy"]
  3. Use <script type="py-game" src="main.py" config="pyscript.toml"></script>
  4. Observe the error when trying to import the package

Minimal Reproducible Example

I've created a minimal example to demonstrate this issue: https://pyscript.com/@dyeaw/pygame-numpy-minimal-example/

Expected Behavior

Packages specified in the configuration should be properly installed and available for import when using type="py-game", just as they are with type="py".

Additional Information

  • PyScript Version: 2025.2.4
  • It can be reproduced in the latest Firefox and Chrome

I understand that PyGame support is experimental, but this issue makes it difficult to build applications that integrate PyGame with other packages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0