New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Pygame won`t install on Mac OS X Lion


Post Reply New Thread Subscribe

 
Thread Tools
xxViennaxx

 
Member Since: Apr 05, 2012
Location: Brazil
Posts: 6
xxViennaxx is on a distinguished road
Mac Specs: MacMini 2007 running OS X Lion || 2GB RAM || 120GB HDD || 2,2GHz

xxViennaxx is offline
Hey, i`m trying to install Pygame for fytoh 3.2.2 on a Mac Mini running OSX 10.7.3, and it keeps failing every single try. I`m using a tutorial from http://programming.itcarlow.ie/PyGameInstall.pdf and got every thing to work, but stuck at Step 7, to build the setup.py file.
Code:
viennamini:pygame Home$ python setup.py build
running build
running build_py
running build_ext
building 'pygame.imageext' extension
/usr/bin/gcc-4.2 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -pipe -Ddarwin -I/Library/Frameworks/SDL.framework/Versions/Current/Headers -I/Library/Frameworks/SDL_image.framework/Versions/Current/Headers -I/usr/local/include -I/usr/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/imageext.c -o build/temp.macosx-10.7-intel-2.7/src/imageext.o
In file included from /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:4,
                 from /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85,
                 from src/pygame.h:75,
                 from src/imageext.c:47:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
error: command '/usr/bin/gcc-4.2' failed with exit status 1
This is the output when I run build. I checked the /Developer folder and the stdarg.h file IS there, so I`m lost. Any ideas?
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,887
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
This doesn't answer your question directly but is there any reason that you're not using a pre-built binary (you can get them here)? That would save you a headache and some time.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
xxViennaxx

 
Member Since: Apr 05, 2012
Location: Brazil
Posts: 6
xxViennaxx is on a distinguished road
Mac Specs: MacMini 2007 running OS X Lion || 2GB RAM || 120GB HDD || 2,2GHz

xxViennaxx is offline
Quote:
Originally Posted by vansmith View Post
This doesn't answer your question directly but is there any reason that you're not using a pre-built binary (you can get them here)? That would save you a headache and some time.
Well, thats the problem, they do not have binaries for Python 3.2 on Mac, just for the 2.x Python. So I tried to compile from the source, but, well, you saw the results.
EDIT: I re-checked the stdarg.h file and it is re-directing the
Code:
#include_next <stdarg.h>
to itself. Perhaps change it? Don't know what to do
QUOTE Thanks
xxViennaxx

 
Member Since: Apr 05, 2012
Location: Brazil
Posts: 6
xxViennaxx is on a distinguished road
Mac Specs: MacMini 2007 running OS X Lion || 2GB RAM || 120GB HDD || 2,2GHz

xxViennaxx is offline
OK, i tried something else. I used MacPorts to install Pygame. Clean and swift. Then I opened Terminal and tested, both with the default Python, 2.7, and the updated one, 3.2.
For the 2.7 it went well. Imported with no errors and I actually managed to create a functional GUI.
Code:
viennamini:~ Home$ python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>>
BUT, for the 3.2 version, I got an error:
Code:
viennamini:~ Home$ python3
Python 3.2.2 (v3.2.2:137e45f15c0b, Sep  3 2011, 17:28:59) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/3.2/site-packages/pygame-1.9.1release-py2.7-macosx-10.7-intel.egg/pygame/__init__.py", line 95, in <module>
    from pygame.base import *
ImportError: dlopen(/Library/Python/3.2/site-packages/pygame-1.9.1release-py2.7-macosx-10.7-intel.egg/pygame/base.so, 2): Symbol not found: _PyCObject_Type
  Referenced from: /Library/Python/3.2/site-packages/pygame-1.9.1release-py2.7-macosx-10.7-intel.egg/pygame/base.so
  Expected in: flat namespace
 in /Library/Python/3.2/site-packages/pygame-1.9.1release-py2.7-macosx-10.7-intel.egg/pygame/base.so
>>>
I managed another way to install and got new problems. Any solutions for any of my problems?
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,887
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
It would appear that Python 3.x is trying to use the 2.x version of Pygame which, as you saw, will never end well given the significant changes between 2.x and 3.x.

The Pygame website suggests that it is mostly compatible with Python 3.x. However, it says you'll have to "copy and paste" files to make it work (see here). As to what that means is a bit of a mystery but I'm guessing that this means you'll have to copy the libraries from the 2.x site-packages folder to the 3.x one.

I'm guessing Pygame will only work with a package manager (like MacPorts) if your whole Python workflow was built with MacPorts. In other words, the MacPorts pygame will work with a MacPorts compiled Python. If you're trying to use a MP Pygame with an official Python installation (or the system one), you'll probably run into trouble.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
xxViennaxx

 
Member Since: Apr 05, 2012
Location: Brazil
Posts: 6
xxViennaxx is on a distinguished road
Mac Specs: MacMini 2007 running OS X Lion || 2GB RAM || 120GB HDD || 2,2GHz

xxViennaxx is offline
Actually, the system Python works just fine with the MP installed Pygame. The real problem is with the official one.

I tried to copy-paste all the Pygame related folders from the 2.7 site-packages folder to the site-packages in the 3.2 folder, and still received an error message.

I also reinstalled Python 3.2 via MP and reinstalled Pygame also from MP. Still the error persists.
(PORTUGUESE) VAI TOMA NO CU SEU PYTHON DE MERDA (PORTUGUESE)

Any ideas more? I would really appreciate using Pygame with Python 3.2 on Mac, but Pygame seems to be a little hard to get working.
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,887
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
Quote:
Originally Posted by xxViennaxx View Post
Any ideas more? I would really appreciate using Pygame with Python 3.2 on Mac, but Pygame seems to be a little hard to get working.
This doesn't surprise me since support for Python 3.x is spotty at best (when you look at the module ecosystem as a whole). It also doesn't surprise me that it works with the system Python since that's Python 2.x.

I would imagine that the version of Pygame from MP would work with their build of Python. Thus, I wonder if you're using the binary installation of Python 3.x that you have installed without knowing it. MP installs its content to /opt/local so execute a "which python" to see what version of Python you're defaulting to. If you're defaulting to the Python.org (official) version, which will be installed to /Library/Frameworks/Python.framework/Versions, you can install the "python_select" tool from MP to switch the default.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
xxViennaxx

 
Member Since: Apr 05, 2012
Location: Brazil
Posts: 6
xxViennaxx is on a distinguished road
Mac Specs: MacMini 2007 running OS X Lion || 2GB RAM || 120GB HDD || 2,2GHz

xxViennaxx is offline
I tried the "which python" and it returned /usr/bin/python, so I don`t know if this is the correct installation. If it isn`t, can you tell me how do I swich?
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,887
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
Unfortunately, that doesn't tell me much since that could either be the system Python or the MP one if it symlinked it to /usr/bin.

Do an "ls -ld /usr/bin/python" and see if it points somewhere. You'll know it does if you get output similar to the following:
Code:
lrwxr-xr-x  1 root  wheel  75 20 Jul  2011 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
You can see there that /usr/bin/python2.7 is a symlink to /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7.

As for changing it, see my python_select suggestion in my previous post.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks

Post Reply New Thread Subscribe


« Using TextMate with Python | -bash g++:command not found »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
lion install OVER lion?? maxcanoe OS X - Operating System 6 11-16-2011 11:15 AM
Mac OS X Lion clean install may need Snow Leopard disc OneMoreThing... Apple Rumors and Reports 1 06-21-2011 06:19 PM
Mac Users Get More ISP Choices schweb Apple Rumors and Reports 1 03-06-2003 10:57 AM

All times are GMT -4. The time now is 06:48 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?