PWhiddy / PokemonRedExperiments

Playing Pokemon Red with Reinforcement Learning
MIT License
6.87k stars 626 forks source link

Problems starting maybe with the SDL libraries? #84

Open Casih opened 11 months ago

Casih commented 11 months ago

Hi! I was trying to set up everything and I'm unsure how to proceed. After installing everything and running python run_pretrained_interactive.py I get the following output:

(pokelearn) User: ~/PokemonRedExperiments/baselines$ python run_pretrained_interactive.py UserWarning: Using SDL2 binaries from pysdl2-dll 2.28.4 X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 148 (GLX) Minor opcode of failed request: 3 (X_GLXCreateContext) Value in failed request: 0x0 Serial number of failed request: 145 Current serial number in output stream: 146

PWhiddy commented 11 months ago

Hi! What kind of system are you on? (os, hardware, ect)

Casih commented 11 months ago

Windows computer, using the subsystem for linux running Ubuntu 22.04.1 LTS

PWhiddy commented 11 months ago

Are you using WSL1 or WSL2? The latter may be necessary for GUI applications to work. Try another gui application and see if it works fine or has a similar issue.

https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps

Casih commented 11 months ago

Thanks I can pull on this thread!

Asdonne commented 11 months ago

I had the same issue and resolved it by restarting my computer following advice from this post https://stackoverflow.com/questions/40644455/x-error-of-failed-request-badvalue-integer-parameter-out-of-range-for-operatio

Casih commented 11 months ago

Asdonne: Those solutions didn't work for me.

I figured out I had silenced the warning which suppressed some of the output from the terminal. this is what I get:

UserWarning: Using SDL2 binaries from pysdl2-dll 2.28.4
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  148 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  151
  Current serial number in output stream:  152

I don't know if this has anything to do with it but the machine I'm trying to run this on doesn't have an Nvidia graphics card. Is that the problem?

Baekalfen commented 11 months ago

The line UserWarning: Using SDL2 binaries from pysdl2-dll 2.28.4 will always be emitted, even when things are running fine. That's just how pysdl2-dll works.

The rest looks like general setup of the machine. Make sure OpenGL, freeglut(?), graphics driver, graphics libraries etc. are working and installed.

stangerm2 commented 11 months ago

Debugging the same error on Ubuntu 22 native (not WSL).

UserWarning: Using SDL2 binaries from pysdl2-dll 2.28.0
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  173
  Current serial number in output stream:  174
matt@matt-dev:~/src/PokemonRedExperiments/baselines$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:    22.04
Codename:   jammy
stangerm2 commented 11 months ago

Installing cuda tools resolved the issues on Ubuntu 22:

$ sudo apt install nvidia-cuda-toolkit nvidia-cuda-toolkit-gcc

Maybe add to that setup readme PR

Baekalfen commented 11 months ago

Does the error appear if you do: python3 -m pyboy PokemonRed.gb? If so, you should open an issue on https://github.com/baekalfen/pyboy instead or post it on the #support_installation Discord channel.

Casih commented 11 months ago

This is the output I get form trying to run the line: python3 -m pyboy PokemonRed.gb. @Baekalfen I've tried reinstalling libGL but there is no change. Is there a way to get a list of the relevant graphics libraries?, this way I could try installing them again or somehting.

UserWarning: Using SDL2 binaries from pysdl2-dll 2.28.4
2886     pyboy                          INFO
The Game Boy controls are as follows:

| Keyboard key | GameBoy equivalant |
| ---          | ---                |
| Up           | Up                 |
| Down         | Down               |
| Left         | Left               |
| Right        | Right              |
| A            | A                  |
| S            | B                  |
| Return       | Start              |
| Backspace    | Select             |

The other controls for the emulator:

| Keyboard key | Emulator function       |
| ---          | ---                     |
| F11          | Toggle fullscreen       |
| Escape       | Quit                    |
| D            | Debug                   |
| Space        | Unlimited FPS           |
| Z            | Save state              |
| X            | Load state              |
| I            | Toggle screen recording |
| O            | Save screenshot         |
| ,            | Rewind backwards        |
| .            | Rewind forward          |
| J            | Memory Window + 0x100   |
| K            | Memory Window - 0x100   |
| Shift + J    | Memory Window + 0x1000  |
| Shift + K    | Memory Window - 0x1000  |

See "pyboy --help" for how to enable rewind and other awesome features!

libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  148 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  151
  Current serial number in output stream:  152
Baekalfen commented 11 months ago

@Casih Ok, then it's PyBoy -- or rather something with your OS. I'd recommend pasting this in the PyBoy Discord channel. Someone there probably has an idea of what's going on.

@PWhiddy I guess you can close this as it's an issue in a dependency.

niazally commented 9 months ago

@Casih I had this same issue on Pop!_OS 22.04. It seems PyBoy is looking in /usr/lib/dri/ for drivers when they are located in /usr/lib/x86_64-linux-gnu/dri/. I fixed it by created a symlink to the directory.

sudo ln -s /usr/lib/x86_64-linux-gnu/dri/ /usr/lib/dri

Hope this helps.