Search code examples
pythondllpygame

Can't load audio on pygame - Pygame error when loading audio: Failed loading libvorbisfile-3.dll: The specified module could not be found


I've been using pygame 2.0.1 consistently for months. Today, after I upgraded to the latest version (2.1.2), I started getting this error when trying to load an audio file:

'pygame.error: Failed loading libvorbisfile-3.dll: The specified module could not be found'.

Things I have tried so far:

  • Downloading the dll and copying it to /site-packages/pygame (it was already there).
  • Downloading the dll and copying to the folder of the script being run
  • Restarting the IDE
  • Restarting Windows
  • Reinstalling pygame
  • Downgrading to pygame 2.0.1

I'm using Windows 10, Python 3.9.10 and running a virtualenv through PyCharm.


Solution

  • I solved the issue by uninstalling Python, installing the latest version (3.10.2), creating a new virtual environment, upgrading pip to the latest version (21.2.4) and then installing pygame via pip.