Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found and preload error #182

Open
ameliazhengg opened this issue Oct 19, 2024 · 1 comment
Open

Module not found and preload error #182

ameliazhengg opened this issue Oct 19, 2024 · 1 comment
Labels

Comments

@ameliazhengg
Copy link

Hi, I am trying to use pygbag to run this pygame: https://github.com/portal-cornell/robotouille/tree/main. However, I cannot get past a black screen. I have imported all dependencies necessary and believe I have main.py set up correctly:

# /// script
# dependencies = [
#  "numpy",
#  "matplotlib",
#  "pandas",
#  "scipy", 
#  "pillow",
#  "cycler",
#  "kiwisolver", 
#  "dateutil",
#  "six", 
#  "gym",
# ]
# ///

from robotouille import simulator
import argparse
import asyncio

async def main():
  while True:
    parser = argparse.ArgumentParser()
    parser.add_argument("--environment_name", help="The name of the environment to create.", default="original")
    parser.add_argument("--seed", help="The seed to use for the environment.", default=None)
    parser.add_argument("--noisy_randomization", action="store_true", help="Whether to use 'noisy randomization' for procedural generation")
    args = parser.parse_args()

    simulator(args.environment_name, args.seed, args.noisy_randomization)
    await asyncio.sleep(0)

asyncio.run(main())

When running in debug mode, I see two main errors:

  1. No module named ‘gym’: I have installed ‘gym’ in my environment and have also added it to the dependencies list. I’ve also tried running pygbag with the -git flag as suggested for non-standard dependencies, but I still can’t resolve the issue
Screenshot 2024-10-19 at 7 21 07 PM
  1. Additionally, I am also seeing a lot of preload errors such as “support/EMSCRIPTEN.c: preload [/data/data/org.python/assets/site-packages/pygame/threads/init.py] ERROR”

Any help debugging these errors would be much appreciated.

@pmp-p
Copy link
Member

pmp-p commented Oct 21, 2024

you may put a request for "gym" here https://github.com/pygame-web/pkg-porting-wasm/issues as it need to be compiled to Web Assembly.
this https://github.com/portal-cornell/robotouille/blob/main/robotouille/robotouille_simulator.py#L14 is a blocking loop and would not work anyway.

all infinite loops must contain "await asyncio.sleep(0)" and be in "async def" functions and must be "await"-ed from caller

@pmp-p pmp-p added the usage label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants