-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Pygbag stops working when importing numpy. #113
Comments
Sorry but Make sure you are using pygbag 0.7.2 and that you removed build folder in the game folder at least once after problem arose and retry to show us the debug console ( http://localhost:8000?-i or http://localhost:8000#debug ). |
I updated to the latest version of pygbag and it still stops when trying to import numpy. I did manage to save the debug console.
What's really strange to me is that it didn't raise any errors at all! Pygbag simply decided to "stop" when it tries to import NumPy for the first time. |
@ProarchwasTaken i would need a screenshot of last third of the javascript console ( ctrl+shift+i ) on a brave/chromium/chrome browser. |
Okay, I got the Console Screenshots. |
@pmp-p I think I found a solution to the issue I'm facing. After asking on reddit , I've found that I have to import the numpy module as soon as possible just after importing pygame. You see, my game is a multi-file project and I never bothered to import numpy into the main file, not in files I needed to use it in. It fixed the "Numpy" Issue but it still didn't work as I realized that there might be more modules that might conflict with pygbag. I had to do a couple hours of debugging just to find out what imported modules are causing pygbag to fail. After searching, I found out the culprits are the Numba and Statistic modules. After I removed them from the project, my game starts to working perfectly fine in the browser. Personally, I think the big issue is: Pygbag doesn't raise an error for situations like this! Instead, pygbag just silently stops, giving absolutely zero information of what's wrong. If it wasn't for that one guy on reddit, I wouldn't have figured it out. For more clarity I would like to link to the reddit comment that helped me figure it out: https://www.reddit.com/r/pygame/comments/162qefm/comment/jxzo8wl/?context=3 |
numpy is quite a special case as it has tons of wasm modules that confuse/crash python when imported too late and that's why it is mentionned here
maybe enhance the wording ? suggestion or - better - PR welcomed |
I was trying to get my game to work in the web browser using Pygbag but all it shows is just a black screen. After some debugging, I've found out that Pygbag stops working when importing the NumPy module for the first time.
Is this anything I could do, or is this just an issue with pygbag? I use pygame_ce 2.3.0 and numpy 1.24.4.
The text was updated successfully, but these errors were encountered: