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

Benjamin Kaplan benjamin.kaplan at case.edu
Sat Dec 26 10:39:02 EST 2009


On Sat, Dec 26, 2009 at 4:57 AM, Mensanator <mensanator at aol.com> wrote:
> On Dec 25, 8:59�pm, Benjamin Kaplan <benjamin.kap... at case.edu> wrote:
>> On Fri, Dec 25, 2009 at 1:19 PM, Mensanator <mensana... at aol.com> wrote:
>> > On Dec 25, 9:25�am, Benjamin Kaplan <benjamin.kap... at case.edu> wrote:
>> >> On Fri, Dec 25, 2009 at 1:48 AM, Mensanator <mensana... at aol.com> wrote:
>> >> > On Dec 24, 10:18�pm, Benjamin Kaplan <benjamin.kap... at case.edu> wrote:
>> >> >> On Thu, Dec 24, 2009 at 9:11 PM, Mensanator <mensana... at aol.com> wrote:
>> >> >> > 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?
>>
>> >> >> 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.
>>
>> >> > 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?
>>
>> >> 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.
>>
>> > 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?
>>
>> I think you'd need different C sources for 2.x and 3.x because I think
>> the C API changed quite a bit.
>
> 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?
>

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
>>
>> >> > --
>> >> >http://mail.python.org/mailman/listinfo/python-list
>>
>> > --
>> >http://mail.python.org/mailman/listinfo/python-list
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list