Skip to content
Advertisement

Pygame installed on windows, getting “pygame.error: Failed loading libwebp-7.dll” when trying to call pygame.image.load()

I’ve got python 3.9.1 running on a windows 10 machine. I have pygame 2.0.1 installed on my machine via pip

(python -m pip install https://github.com/pygame/pygame/releases/download/2.0.1/pygame-2.0.1-cp39-cp39-win_amd64.whl)

however on calling pygame.image.load("file.png") I get the error:

pygame.error: Failed loading libwebp-7.dll: The specified module could not be found.

I’ve tried installing through pip install pygame and running the tests in pygame.tests but they run fine.

Advertisement

Answer

I managed to fix this error by using the whl file at https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame rather than from the github releases. I’m not sure why this worked, but I hope anyone else having this issue is helped by this.

Advertisement