9

I just installed PyGame 1.9.1 (onto an existing python 2.6.4). Python and it standard libraries work, however, there is a problem with python even being able to find the pygame modules (correctly).

Traceback (most recent call last):
  File "C:\foo\bar\firstGame.py", line 2, in <module>
    import pygame
  File "C:\python264\lib\site-packages\pygame\__init__.py", line 95, in <module>
    from pygame.base import *
ImportError: DLL load failed: The specified module could not be found.

Why is is this happening? Googling yielded the following responses, which I have tried to no avail:

Anyone out there fixed problems in win + pygame?

Thanks


EDIT: more information added as requested:
- Windows version: Windows Vista (updated regularly)
- Installer used: Windows MSI installers
- Installed for: All users
- Number of files in C:\python264\lib\site-packages\pygame:

  • DLL : 14
  • PYD : 34
  • PY : 19
  • PYC : 1
bguiz
  • 27,371
  • 47
  • 154
  • 243
  • Potentially important information that's missing: which package did you install (probably the Windows .msi installer)? did you "install for all users" or just yourself? which Windows are you running? in the pygame folder, how many .pyd files and how many .dll files do you have? – Peter Hansen Dec 28 '09 at 13:46
  • yup, edited the question to add this information. – bguiz Dec 29 '09 at 09:21

7 Answers7

4

Are you sure you have got pygame for Python 2.6? The version for 2.5 wont work and produce this error msg, because the pyd file wont find the python 2.5 dll.

tillsten
  • 14,491
  • 5
  • 32
  • 41
  • how is you pygame installer called? please check if it is: http://pygame.org/ftp/pygame-1.9.1.win32-py2.6.msi else you check the pyd (.dll) files with the dependencywalker to see which kind of dll their are missing. – tillsten Dec 29 '09 at 14:08
  • thanks tillsten, when I did a complete wipe of the existing installation, and then reinstalled using this installer, it solved my problem. – bguiz Dec 29 '09 at 15:18
3

I have faced this error on a Windows 64 bit. I have uninstalled my python 3.4.1 and I have installed: python-3.4.1.amd64.msi then pygame-1.9.2a0.win-amd64-py3.4.exe from link mentioned above. And it worked.

Mihai
  • 31
  • 1
2

If you are running a 64 bit version of windows, with a 64 bit python, the default installers on the Pygame site don't seem to work.

The pygame website led me there: There are some pre release binaries for 64bit windows, and for python 2.7 at http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

Derek
  • 409
  • 1
  • 4
  • 6
1

This actually happened to my installation as well. I have Python 2.6.6 installed, but the installation did not include Pygame. I downloaded Pygame 1.9.1 with Python 2.6, and identified where the directory was located, the installation seemed to work. However, from the IDLE, I entered import pygame, and received the very error originally posted.

codezealot
  • 39
  • 1
  • 8
0

I had the exact same error however i ran a small program i found the used pygame without the IDLE(by saving the code and then just double clicking on the .py file) and it worked 100% fine.

0

To check exactly which DLL's are missing use the CMD like python console. It will show a pop-up message indicating the missing DLL. Pygame works for me.

whatnick
  • 5,400
  • 3
  • 19
  • 35
  • I can run python's console (IDLE) without any popups appearing. How do I trigger this popup message? Like I said, python with its std libraries work fine, but when I import from pygame, the stacktrace (posted in the question) appears. – bguiz Dec 29 '09 at 09:20
  • Try the one that says Python Command Line (NOT IDLE) in your list of short cuts. – whatnick Dec 29 '09 at 14:49
  • thanks, i've solved the problem using a fresh install of pygame, linked by tillsten. – bguiz Dec 30 '09 at 03:53
0

I had this error and after much digging discovered that the version of python interpreter MUST match the version of pygame installed.

If you have an erroneous combination, your best bet is to uninstall what you have via Start -> Control Panel -> Uninstall Programs.

A combination that works (Install in this order) -

Python 3.2.5 - Msi download this file for Windows Vista 32-bit-

www.python.org/download/releases/3.2.5/ - Windows x86 MSI Installer (3.2.5) <- This link, about halfway down the page

Pygame - pygame.org/download.shtml -

pygame-1.9.2a0.win32-py3.2.msi <- This download link, bottom of the top list on the page.

Now you should be able to open IDLE (The default development environment) by finding the python folder from your start menu. Once it's open, type 'import pygame'. Hopefully, you'll get no errors and pygame was imported properly. I wish you luck with your programming endeavours.

If you're dissatified with the IDLE environment and want to use another, I personally use the LiClipse IDE. I have no rep, but a google search should turn that one out ;)