Installing PyGame?

E

Eam onn

Perhaps this isn't the right place to post this, but it's the only place I could find.

I asked yesterday or the day before about Python Game Development, and havefound a few tutorials on PyGame. Now I have a bigger problem: HOW THE HECKDO I INSTALL PYGAME!?!?! System Details:

• Mac OS X 10.8.4 Mountain Lion
• 4GB DDR3 RAM

I do have Window's installed, as well as Ubuntu 11.04 but I would like to use Mac OS X if possible. I've tried using MacPorts, Fink, the Mac DMG, source installing, installing NumPY, just about every way possible. I can't seem to get it working, I keep getting an error in all my versions of IDLE. I've tried:

• IDLE 2.5
• IDLE 2.7.2
• IDLE 2.7.3
• IDLE 3.1
• IDLE 3.3.1

None of the versions work. I'm using PyGame 1.9.1.

Thanks! Any help is appreciated!
 
F

Fábio Santos

I keep getting an error in all my versions of IDLE.

What error is that? Show us. Errors carry strong hints.

Also, are you following an install guide/tutorial? Which one?

Cheers
 
E

Eam onn

What error is that? Show us. Errors carry strong hints.

Also, are you following an install guide/tutorial? Which one?

Cheers

I'm not following a guide, but I have followed about 20 - No exaggeration. Here's the error I am getting:

ERROR 1: Terminal
--------

COMMAND: import pygame

File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module>
from pygame.base import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper


ERROR 2: IDLE (all versions)
--------

COMMAND: import pygame

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pygame
ImportError: No module named 'pygame'




Any idea as to what is going on? Terminal is V2.7.3 of Python.
 
C

cclauss

At the Terminal prompt type: python -c "help('modules')"

If Pygame is not somewhere in the output then Pygame is not yet installed.

If it is not installed then type: pip install --upgrade pygame
 
E

Eam onn

At the Terminal prompt type: python -c "help('modules')"



If Pygame is not somewhere in the output then Pygame is not yet installed.



If it is not installed then type: pip install --upgrade pygame

python -c "help('modules')" made an error. pip install --upgrade pygame made an error too.
 
E

Eam onn

python -c "help('modules')" made an error. pip install --upgrade pygame made an error too.

Wait, the python -c "help('modules')" worked after spamming it a few times. Pygame was listed but it won't do anything when I type in 'import pygame' I still get the error :(
 
D

Dennis Lee Bieber

python -c "help('modules')" made an error. pip install --upgrade pygame made an error too.

And again, you didn't bother to copy the error message text into the
post.

Off-hand, since you stated Mac OS at some point in time...

The system Python tends, as I recall, to only want Apple sourced
libraries.

You may want to figure out how to install an alternate Python (that is
NOT in the system PATH), set your user account path to find that version
first, and then install your add-on modules to that alternate Python.
<html>
<body>
<font face="Lucida Console">-- <br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Wulfraed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dennis Lee Bieber&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AF6VN<br>
&nbsp;&nbsp;&nbsp; (e-mail address removed)&nbsp;&nbsp;&nbsp; <a href="http://wlfraed.home.netcom.com/" eudora="autourl">HTTP://wlfraed.home.netcom.com/<br>
</a></font></body>
</html>
 
F

Fábio Santos

Wait, the python -c "help('modules')" worked after spamming it a few
times. Pygame was listed but it won't do anything when I type in 'import
pygame' I still get the error :(

Try to always say what your error was.

Do you have pip installed? Pygame AFAIK is a c extension so it requires a
working compiler. I think you need to have one.
 
C

cclauss

Type: python -V
(That was a capitol V) What version of python is running?

Type: python3 -V
(That was a capitol V) What version of python is running?

Type: python -c 'import pygame'
What is the exact error message?

Type: python
Your prompt should change to something like: >>>
Type: import pygame
What is the exact error message?
 
D

Dennis Lee Bieber

<html>
<body>
<font face="Lucida Console">-- <br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Wulfraed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dennis Lee Bieber&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AF6VN<br>
&nbsp;&nbsp;&nbsp; (e-mail address removed)&nbsp;&nbsp;&nbsp; <a href="http://wlfraed.home.netcom.com/" eudora="autourl">HTTP://wlfraed.home.netcom.com/<br>
</a></font></body>
</html>

ACK!

Sorry about that; I'm configuring a new computer and apparently somehow
generated HTML signatures (shared with Eudora).

Hopefully I've corrected that matter
 
R

rohit782192

Perhaps this isn't the right place to post this, but it's the only place I could find.



I asked yesterday or the day before about Python Game Development, and have found a few tutorials on PyGame. Now I have a bigger problem: HOW THE HECK DO I INSTALL PYGAME!?!?! System Details:



* Mac OS X 10.8.4 Mountain Lion

* 4GB DDR3 RAM



I do have Window's installed, as well as Ubuntu 11.04 but I would like touse Mac OS X if possible. I've tried using MacPorts, Fink, the Mac DMG, source installing, installing NumPY, just about every way possible. I can't seem to get it working, I keep getting an error in all my versions of IDLE. I've tried:



* IDLE 2.5

* IDLE 2.7.2

* IDLE 2.7.3

* IDLE 3.1

* IDLE 3.3.1



None of the versions work. I'm using PyGame 1.9.1.



Thanks! Any help is appreciated!
 
T

Terry Reedy

On 4/24/2014 11:32 AM, (e-mail address removed) wrote:

When you post, please do more than just quote. If you are relaying a
private email, please say so.
I did not see the original post, if indeed there was a public one.

[snip pygame/numpy problems]
....
Idle depends on tkinter. Tkinter depends on having a tcl/tk that works,
at least for tkinter. The following page has essential info about
getting the right tcl/tk installed.
https://www.python.org/download/mac/tcltk
 
S

Steven D'Aprano

On 4/24/2014 11:32 AM, (e-mail address removed) wrote:

When you post, please do more than just quote. If you are relaying a
private email, please say so.
I did not see the original post, if indeed there was a public one.

Check out the date. It was over ten months ago.
 
G

Gregory Ewing

My advice would be to steer clear of things like Fink and MacPorts
and do things the native MacOSX way wherever possible. That means
using a framework installation of Python and framework versions of
the various libraries that PyGame uses.

There are a number of steps to getting pygame working:

1) Make sure you have a working framework installation of an
appropriate version of Python. I installed mine from source,
but a binary installation should work too. Depending on your
MacOSX version, the system python might be sufficient.

2) Install framework versions of the SDL library and other
libraries that pygame uses.

You may need to hunt around a bit, but you should be able to find
DMG installers for all of these. In my /Library/Frameworks I have:

SDL.framework
SDL-QD.framework
SDL_image.framework
SDL_mixer.framework
SDL_net.framework
SDL_ttf.framework

3) Install pygame itself with the usual 'python setup.py install'.
If you have all the relevant libraries, the installer will auto
detect them and use them. At the end, it will tell you which ones
it couldn't find. Pygame will work without some of them, but those
features won't be available. You can add more libraries and run
setup.py again if you need to.

4) Specific games may require other Python libraries such as
Numpy etc.
 
G

Gregory Ewing

Terry said:
Idle depends on tkinter. Tkinter depends on having a tcl/tk that works,
at least for tkinter. The following page has essential info about
getting the right tcl/tk installed.
https://www.python.org/download/mac/tcltk

Also keep in mind that you don't *have* to use IDLE at all.
I do all my Python development on MacOSX using BBEdit Lite
and the Terminal.

If nothing else, you can try out pygame that way to see
whether your problem is a pygame-related one or something
else.
 
N

Ned Deily

My advice would be to steer clear of things like Fink and MacPorts
and do things the native MacOSX way wherever possible. That means
using a framework installation of Python and framework versions of
the various libraries that PyGame uses.

FYI, MacPorts Pythons are framework installations. And I disagree that
installing a bunch of disparate software from various sources via binary
installers and/or source is to be preferred to a modern third-party
package manager on OS X like MacPorts or Homebrew. That's just setting
yourself up for a long-term maintenance headache. What could be easier
than:

sudo port install py27-game
 
R

Ryan Hiebert

FYI, MacPorts Pythons are framework installations. And I disagree that
installing a bunch of disparate software from various sources via binary
installers and/or source is to be preferred to a modern third-party
package manager on OS X like MacPorts or Homebrew. That's just setting
yourself up for a long-term maintenance headache. What could be easier
than:

sudo port install py27-game

I'd love to hear more about Greg's take on MacPorts. I've chosen to use
MacPorts because it keeps things separate, because when things get hosed
using the system libraries, I don't have to erase my whole system to get
back to a "vanilla" OS X install. Unfortunately, it seems like the
differences in which libraries are used, what options are enabled at
library build time, etc, make it difficult to ensure that things always
work when you try to use the stuff built-in to the system, and untangling
the Homebrew mess can be painful.
 
G

Gregory Ewing

Ned said:
I disagree that
installing a bunch of disparate software from various sources via binary
installers and/or source is to be preferred to a modern third-party
package manager on OS X like MacPorts or Homebrew. That's just setting
yourself up for a long-term maintenance headache. What could be easier
than:

sudo port install py27-game

That's fine if it works, but the OP said he'd already tried
various things like that and they *didn't* work for him. And
I've had trouble in the past with MacPorts and/or Fink (can't
remember exactly which one it was) installing libraries that
were incompatible with other things I use and messing them
up, so I've learned to be wary of them.

Those problems were probably due to some unusual features of
my setup, and wouldn't occur for most other people. But
because I don't use those tools, I can't give any
recommendations about how to troubleshoot them. All I can
do is explain what works for me.
 
G

Gregory Ewing

Ryan said:
I've chosen to use
MacPorts because it keeps things separate, because when things get hosed
using the system libraries, I don't have to erase my whole system to get
back to a "vanilla" OS X install.

I don't know what you're doing to hose your system that badly.
I've never had a problem that couldn't be fixed by deleting
whatever the last thing was I added that caused it.

Also the problems I had with one of the third-party package
managers was because it *didn't* keep its own stuff properly
separated. It installed libraries on my regular library path
so that they got picked up by things that they weren't
appropriate for.

I'm not saying that MacPorts is a bad thing. If it's the
*only* thing you use, it's probably fine. But I use a wide
variety of libraries, not all of them available that way,
and many of them installed from source, and I find it's
less hassle overall to do everything the native MacOSX way
wherever possible.
 
A

Andrea D'Amore

I don't know what you're doing to hose your system that badly.
I've never had a problem that couldn't be fixed by deleting
whatever the last thing was I added that caused it.

The actual problem with the "native MacOSX way" is that there's no
official way to uninstall a package once it's installed.
Also the problems I had with one of the third-party package
managers was because it *didn't* keep its own stuff properly
separated. It installed libraries on my regular library path
so that they got picked up by things that they weren't
appropriate for.

This most likely was not MacPorts, its default install path is not
checked by dyld by default.
But I use a wide
variety of libraries, not all of them available that way,
and many of them installed from source, and I find it's
less hassle overall to do everything the native MacOSX way
wherever possible.

Well, the "native" MacOSX way would probably be registering a package
via installer(8) not compiling from source.

As long as you're comfortable with your system then it's good for you.
In my experience the more libraries/software I install the more useful
a package manager becomes in terms of stray files left when upgrading or
uninstalling.


I use a mix of MacPorts to provide the base tools and virtualenv for
project-specific pypi libraries.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top