Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I install GMPY 1.11 on a Mac with OS X 10.6 and Python 3.1?

38 views
Skip to first unread message

Mensanator

unread,
Dec 24, 2009, 9:11:19 PM12/24/09
to
Ok, so I got a MacBook Air.

Has OS X 10.6 (Snow Leopard) and Python 2.6.1 already installed.

So I install Xcode, download macports and download gmpy-1.11rc1.

Following the instructions in mac_build.txt, I do the following:

- sudo /opt/local/bin/port install gmp

This works fine.

Then I do

- python setup.py install

This also works (a few warnings, but nothing looked serious).

Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import gmpy
>>> gmpy.version()
'1.11'

python gmpy_test.py
Unit tests for gmpy 1.11
on Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)]
Testing gmpy 1.11 (GMP 4.3.1), default caching (100, 128)
gmpy_test_cvr 151 tests, 0 failures
.
.
.
25 tests in gmpy_test_rnd.__test__.rand
1469 tests in 42 items.
1469 passed and 0 failed.
Test passed.

Looks like a viable gmpy module for 2.6.

What do I do AFTER I install Python 3.1? Just running python3.1 from
the
same directory doesn't work.

I've spent the last 5 days trying to figure that out. I hosed it so
bad
I somehow wrecked the 2.6 version to the point where it won't even
load.

I just got done doing a factory restore of the entire OS to undo
everything
I did. Re-did all the above and got it back working. Haven't re-
installed 3.1
yet.

Anbody have any idea how to make this work?

Benjamin Kaplan

unread,
Dec 24, 2009, 11:18:56 PM12/24/09
to pytho...@python.org

Did you run setup.py with python3? Python 3.1 won't install itself as
the default python install for compatibility reasons so you have to
run "python3 install setup.py" to install it for that version of
python.

> --
> http://mail.python.org/mailman/listinfo/python-list
>

Mensanator

unread,
Dec 25, 2009, 1:48:30 AM12/25/09
to
On Dec 24, 10:18 pm, Benjamin Kaplan <benjamin.kap...@case.edu> wrote:

I wondered why there was both python3 and python3.1 in the bin
directory.

But why, when I type...

$ python3

...do I get...

Python 3.1.1 (r311:74543, Aug 24 2009, 18:44:04)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin


Type "help", "copyright", "credits" or "license" for more information.
>>>

[1]+ Stopped python3

I get the same result with python3.1.

So, no, trying python3 is of no help, same errors as before.
There's hundreds of them, but they start out

$ /Library/Frameworks/Python.framework/Versions/3.1/bin/python3
setup.py install
running install
running build
running build_ext
building 'gmpy' extension
creating build/temp.macosx-10.3-fat-3.1
creating build/temp.macosx-10.3-fat-3.1/src
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/
MacOSX10.4u.sdk
Please check your Xcode installation
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -
fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I./src -I/
opt/local/include -I/Library/Frameworks/Python.framework/Versions/3.1/
include/python3.1 -c src/gmpy.c -o build/temp.macosx-10.3-fat-3.1/src/
gmpy.o
In file included from src/gmpy.c:206:
/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1/
Python.h:11:20: error: limits.h: No such file or directory
/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1/
Python.h:14:2: error: #error "Something's broken. UCHAR_MAX should be
defined in limits.h."
/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1/
Python.h:18:

Any other ideas? Do I have to install a separate Python 3?

>
>
>
> > --
> >http://mail.python.org/mailman/listinfo/python-list

Benjamin Kaplan

unread,
Dec 25, 2009, 10:25:43 AM12/25/09
to pytho...@python.org

That's not a Python 3 problem. It appears to be a problem in the build script.

> Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/
> MacOSX10.4u.sdk

My guess would be you're on Snow Leopard while the original developer
is either on Tiger or Leopard. The script wants to use the 10.4 SDK
but Apple only includes the SDKs for the latest 2 versions of OS X.

>>
>>
>>
>> > --
>> >http://mail.python.org/mailman/listinfo/python-list
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Mensanator

unread,
Dec 25, 2009, 1:09:10 PM12/25/09
to
On Dec 25, 9:25 am, Benjamin Kaplan <benjamin.kap...@case.edu> wrote:

Yes, this machine has OS X 10.6.

> while the original developer
> is either on Tiger or Leopard. The script wants to use the 10.4 SDK
> but Apple only includes the SDKs for the latest 2 versions of OS X.

Is there any easy way to fix the build script? Is there a hard way?
Which files comprise the build script?

Thanks for your help.

Benjamin Kaplan

unread,
Dec 25, 2009, 1:16:33 PM12/25/09
to pytho...@python.org

I honestly have no idea how to fix this. I'm not very experienced with
build scripts. I just noticed that I had the 10.4 SDK on Leopard but
not on Snow Leopard and the script seems to want that version. My
guess would be that the option is either in a setup.py file or a
makefile in there.

> --
> http://mail.python.org/mailman/listinfo/python-list
>

Mensanator

unread,
Dec 25, 2009, 1:19:50 PM12/25/09
to
On Dec 25, 9:25 am, Benjamin Kaplan <benjamin.kap...@case.edu> wrote:

I just thought of something. Why I am able to do the build for python
2.6?
Wouldn't that also fail for lack of a 10.4 SDK?

Benjamin Kaplan

unread,
Dec 25, 2009, 9:59:03 PM12/25/09
to pytho...@python.org

I think you'd need different C sources for 2.x and 3.x because I think
the C API changed quite a bit. That might be why it worked for 2.6 but
failed for 3.1

> --
> http://mail.python.org/mailman/listinfo/python-list
>

Mensanator

unread,
Dec 26, 2009, 4:57:17 AM12/26/09
to
On Dec 25, 8:59�pm, Benjamin Kaplan <benjamin.kap...@case.edu> wrote:

I can see that.

> That might be why it worked for 2.6 but
> failed for 3.1

But Python 2.6 must not care about whether the 10.4SDK
exists or not. It must be using 10.5 or 10.6 since they
are te only SDKs that do exist.

As far as different sources, only one set is supplied and
it specifically states in the comments that the source
supports 3.x. There are, after all, 3.1 versions of the
windows installer.

I certainly woudn't be surprised by the need for seperate
sources, but wouldn't such seperate sources have been
supplied and seperate setup scripts been provided?

Benjamin Kaplan

unread,
Dec 26, 2009, 10:39:02 AM12/26/09
to pytho...@python.org

I was just digging though the sources- turns out it is a Python issue.
GMPY compiles using distutil's makefile.
/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/config/Makefile

That makefile specifies the 10.4 SDK and a MACOSX_DEPLOYMENT_TARGET of
10.3. I don't know how you'd fix this to work on all supported
versions of OS X, but that seems to be the problem.

> --
> http://mail.python.org/mailman/listinfo/python-list
>

casevh

unread,
Dec 26, 2009, 12:05:38 PM12/26/09
to
On Dec 26, 7:39 am, Benjamin Kaplan <benjamin.kap...@case.edu> wrote:
(I'm one of the GMPY maintainers but I have no access to Macs....)

The same GMPY source should should compile with all version of Python
2.4 and later.

I think the makefile is created when that specific version of Python
is compiled. Was Python 3.1 included with OS X or was it installed
separately? If it was installed separately, was it installed from
macports or python.org?

I have a couple other generic questions.

Is Python 2.6 built as a 32 or 64-bit application? (sys.maxint)

Is the gmp library 32 or 64-bit? (gmpy.gmp_limbsize())

For best performance with large numbers, GMPY should be compiled as a
64-bit application. If Python and gmp are not compiled in 64-bit mode,
you probably will want to compile both of them from source or find 64-
bit versions.

casevh

Benjamin Kaplan

unread,
Dec 26, 2009, 3:07:21 PM12/26/09
to pytho...@python.org
On Sat, Dec 26, 2009 at 12:05 PM, casevh <cas...@gmail.com> wrote:
> (I'm one of the GMPY maintainers but I have no access to Macs....)
>
> The same GMPY source should should compile with all version of Python
> 2.4 and later.
>

Like I said in the my last post, it appears to be an issue with
distutils distributed with the python.org installer. The makefile
distutils uses to compile C sources specifies the SDK for 10.4, but
Apple only gives the SDKs for the latest two versions of OS X (10.5
and 10.6 right now)

> I think the makefile is created when that specific version of Python
> is compiled. Was Python 3.1 included with OS X or was it installed
> separately? If it was installed separately, was it installed from
> macports or python.org?
>

Python 3 has to be installed separately. The issues appear in the
python.org installer. I haven't tried using Macports yet.

> I have a couple other generic questions.
>
> Is Python 2.6 built as a 32 or 64-bit application? (sys.maxint)
>
> Is the gmp library 32 or 64-bit? (gmpy.gmp_limbsize())
>
> For best performance with large numbers, GMPY should be compiled as a
> 64-bit application. If Python and gmp are not compiled in 64-bit mode,
> you probably will want to compile both of them from source or find 64-
> bit versions.

Macs usually work with Universal binaries. The System's Python 2.6 is
a 3-way binary: ppc, i386, and x86_64. It runs in 64-bit mode when
you're on a Mac with a 64-bit processor and 32-bit mode when you're on
a 32-bit processor. If gmp was built using Macports, then it was
compiled to whatever the system supports, so most likely 64-bit.

Mensanator

unread,
Dec 26, 2009, 4:36:43 PM12/26/09
to
On Dec 26, 2:07 pm, Benjamin Kaplan <benjamin.kap...@case.edu> wrote:

PROBLEM RESOLVED!

Yes, it does appear that the disk image on pytho.ord is defective
(maybe they made the image from an obsolete version?)

I installed Python 3.1 from macports and everything seems to work
now. (I never would have figured it out, although installing
from macports was on my long erm list of things to try).

# after macports install of Python 3.1

$ python setup.py install


running install
running build
running build_ext
building 'gmpy' extension

creating build/temp.macosx-10.6-i386-3.1
creating build/temp.macosx-10.6-i386-3.1/src
/usr/bin/gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g
-fwrapv -O3 -Wall -Wstrict-prototypes -I./src -I/opt/local/include -I/
opt/local/Library/Frameworks/Python.framework/Versions/3.1/include/
python3.1 -c src/gmpy.c -o build/temp.macosx-10.6-i386-3.1/src/gmpy.o
creating build/lib.macosx-10.6-i386-3.1
/usr/bin/gcc-4.2 -L/opt/local/lib -bundle -undefined dynamic_lookup
build/temp.macosx-10.6-i386-3.1/src/gmpy.o -L/opt/local/lib -lgmp -o
build/lib.macosx-10.6-i386-3.1/gmpy.so
running install_lib
copying build/lib.macosx-10.6-i386-3.1/gmpy.so -> /opt/local/Library/
Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages
error: /opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/
python3.1/site-packages/gmpy.so: Permission denied

# minor glitch, easily resolveable

$ sudo python setup.py install


running install
running build
running build_ext

running install_lib
copying build/lib.macosx-10.6-i386-3.1/gmpy.so -> /opt/local/Library/
Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages
running install_egg_info
Writing /opt/local/Library/Frameworks/Python.framework/Versions/3.1/
lib/python3.1/site-packages/gmpy-1.11rc1-py3.1.egg-info

$ python
Python 3.1.1 (r311:74480, Dec 26 2009, 15:02:38)
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin


Type "help", "copyright", "credits" or "license" for more information.
>>> import gmpy
>>> gmpy.version()
'1.11'
>>>

[2]+ Stopped pytho

$ python test3/gmpy_test.py


Unit tests for gmpy 1.11

on Python 3.1.1 (r311:74480, Dec 26 2009, 15:02:38)
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)]


Testing gmpy 1.11 (GMP 4.3.1), default caching (100, 128)

gmpy_test_cvr 148 tests, 0 failures
gmpy_test_rnd 26 tests, 0 failures
.
.
.
1500 tests in 42 items.
1500 passed and 0 failed.
Test passed.

Thanks guys, you saved my Christmas! I was afraid this MacBook was
going
to turn into a waste of money.

I guess the point here is NEVER use the disk image on python.org,
ALWAYS use macports to install Python 3.1.

At least until python.org fixes it.

Benjamin Kaplan

unread,
Dec 26, 2009, 4:57:30 PM12/26/09
to pytho...@python.org
On Sat, Dec 26, 2009 at 4:36 PM, Mensanator <mensa...@aol.com> wrote:
>
> I guess the point here is NEVER use the disk image on python.org,
> ALWAYS use macports to install Python 3.1.
>
> At least until python.org fixes it.

Have you filed a bug report on this?

Mensanator

unread,
Dec 26, 2009, 5:20:13 PM12/26/09
to
On Dec 26, 3:57 pm, Benjamin Kaplan <benjamin.kap...@case.edu> wrote:

> On Sat, Dec 26, 2009 at 4:36 PM, Mensanator <mensana...@aol.com> wrote:
>
> > I guess the point here is NEVER use the disk image on python.org,
> > ALWAYS use macports to install Python 3.1.
>
> > At least until python.org fixes it.
>
> Have you filed a bug report on this?

I will.

Mensanator

unread,
Dec 26, 2009, 9:21:07 PM12/26/09
to

...NOT!

*I* won't be filling a bug report because *I* am still
locked out of python.org (it won't let me register).

Sorry, but this is beyond my control. All I can do is
report problems on comp.lang.python.

Benjamin Kaplan

unread,
Dec 26, 2009, 11:02:46 PM12/26/09
to pytho...@python.org

Mensanator

unread,
Dec 26, 2009, 11:53:37 PM12/26/09
to
On Dec 26, 10:02 pm, Benjamin Kaplan <benjamin.kap...@case.edu> wrote:

> On Sat, Dec 26, 2009 at 9:21 PM, Mensanator <mensana...@aol.com> wrote:
> > On Dec 26, 4:20 pm, Mensanator <mensana...@aol.com> wrote:
> >> On Dec 26, 3:57 pm, Benjamin Kaplan <benjamin.kap...@case.edu> wrote:
>
> >> > On Sat, Dec 26, 2009 at 4:36 PM, Mensanator <mensana...@aol.com> wrote:
>
> >> > > I guess the point here is NEVER use the disk image on python.org,
> >> > > ALWAYS use macports to install Python 3.1.
>
> >> > > At least until python.org fixes it.
>
> >> > Have you filed a bug report on this?
>
> >> I will.
>
> > ...NOT!
>
> > *I* won't be filling a bug report because *I* am still
> > locked out of python.org (it won't let me register).
>
> > Sorry, but this is beyond my control. All I can do is
> > report problems on comp.lang.python.
> > --
>
> Alright. I filed it.http://bugs.python.org/issue7580

Thank you! I would hate to see anyone else go through this hassle.

>
>
>
> >http://mail.python.org/mailman/listinfo/python-list

Steve Holden

unread,
Dec 27, 2009, 9:19:45 AM12/27/09
to pytho...@python.org
Perhpas you would do me a favor and report the problem about being
unable to register on bugs.python.org to the pydotorg webmaster list
(pydotorg at python dot org) and let me know if you get any result.

Please be sure to identify explicitly what the problem is and on which
page(s) it occurs.

Thanks
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/

Mensanator

unread,
Dec 27, 2009, 2:43:28 PM12/27/09
to
On Dec 27, 8:19 am, Steve Holden <st...@holdenweb.com> wrote:
> Mensanator wrote:
> > On Dec 26, 10:02 pm, Benjamin Kaplan <benjamin.kap...@case.edu> wrote:
> >> On Sat, Dec 26, 2009 at 9:21 PM, Mensanator <mensana...@aol.com> wrote:
> >>> On Dec 26, 4:20 pm, Mensanator <mensana...@aol.com> wrote:
> >>>> On Dec 26, 3:57 pm, Benjamin Kaplan <benjamin.kap...@case.edu> wrote:
> >>>>> On Sat, Dec 26, 2009 at 4:36 PM, Mensanator <mensana...@aol.com> wrote:
> >>>>>> I guess the point here is NEVER use the disk image on python.org,
> >>>>>> ALWAYS use macports to install Python 3.1.
> >>>>>> At least until python.org fixes it.
> >>>>> Have you filed a bug report on this?
> >>>> I will.
> >>> ...NOT!
> >>> *I* won't be filling a bug report because *I* am still
> >>> locked out of python.org (it won't let me register).
> >>> Sorry, but this is beyond my control. All I can do is
> >>> report problems on comp.lang.python.
> >>> --
> >> Alright. I filed it.http://bugs.python.org/issue7580
>
> > Thank you! I would hate to see anyone else go through this hassle.
>
> >>>http://mail.python.org/mailman/listinfo/python-list
>
> Perhpas you would do me a favor and report the problem about being
> unable to register on bugs.python.org to the pydotorg webmaster list
> (pydotorg at python dot org) and let me know if you get any result.

Ok, i reported it.

>
> Please be sure to identify explicitly what the problem is and on which
> page(s) it occurs.

It wasn't any page per se, it was supposed to send an e-mail for me to
follow up the registration. I never got any e-mail.

0 new messages