it gets worse (was: How do you configure IDLE on a Mac...)

Mensanator mensanator at aol.com
Wed Jan 6 03:51:22 CET 2010


On Jan 5, 4:03 pm, Ned Deily <n... at acm.org> wrote:
> In article
> <6672dad2-26ba-458b-8075-21bac6506... at e37g2000yqn.googlegroups.com>, Mensanator <mensana... at aol.com> wrote:
>
> [...]
>
>
>
>
>
> > So, for all practical purposes, the macports install is broken also.
>
> > IDLE simply does not work in an X11 window (you think someone would
> > have noticed that). The missing preferences is just the beginning.
> > Apparently NONE of the menu item shortcuts work.
>
> > For example, the Cut, Copy, Paste shortcuts are given as Command-X,
> > Command-C and Command-V. But that doesn't work in an X11 window,
> > apperently only in an Aqua Tk (parent application appears as IDLE).
>
> > Of course, I can do Control-X, Control-C and Control-V to do Cut,
> > Copy and Paste. Don't know if this works for all shortcuts, but
> > I suppose I could just pick them from the menu (and I can bang
> > my head against the wall while I'm at it).
>
> > What do you think, suppose I copy the gmpy built with the macports
> > install over to the directory where the python.org version is? Would
> > it
> > import? If that'll work, I can switch back to using the python.org
> > install and use it's version of IDLE. I certainly won't be needing
> > distutils once I have a working version of gmpy.
>
> Let's go back to your original problem, which, if I understand
> correctly, was trying to get going with Python 3 and gmpy on OS X 10.6.  

Right.

> (Sorry I was away over the holidays and didn't get a chance to respond
> to your original postings at the time.)  

Hey, no problem. I bought this dingus with the idea I would
spend my the holiday time to get it to work. Boy, was I right.

> I believe the problems you
> originally encountered with installing gmpy were all due to a couple of
> problems with building C extension modules on 10.6 when using the
> current 3.1.1 OS X python.org.  

Yeah, I used the Mac disk image for Python 3.1.

> Unfortunately, 3.1.1 was released before
> 10.6 was so there are a couple of important fixes that haven't yet been
> released for 3.1 (but are in the 2.6.4 installer which was released
> after 10.6 came out).  Fortunately, though, there are simple workarounds
> for the problems.  Keep in mind, though, that, at the moment, the
> python.org installers for OS X are 32-bit only;

I just checked, I was told to check sys.maxint but that doesn't exist,
I assume it's now sys.maxsize. On the python.org disk image, that
returns

>>> hex(sys.maxsize)
'0x7fffffff'

looks like 32 bits.

> that will change in the
> future but if you do need a 64-bit Python 3 you'll need to stick to
> other solutions like MacPorts for the time being.

The macports install of 3.1 gives:

>>> hex(sys.maxsize)
'07x7fffffffffffffff'

so the macports must be 64 bits.

>
> First, make sure the gmp library you've installed has 32-bit support.  

Uh, why would I want that? If it comes down to a choice between
IDLE and 64 bits, I'll live without IDLE.

> If you installed it using MacPorts, check with the file command:
>
> $ file /opt/local/lib/libgmp.dylib
> /opt/local/lib/libgmp.dylib: Mach-O universal binary with 2 architectures
> /opt/local/lib/libgmp.dylib (for architecture i386):  Mach-O dynamically
> linked shared library i386
> /opt/local/lib/libgmp.dylib (for architecture x86_64):   Mach-O 64-bit
> dynamically linked shared library x86_64

I get

/opt/local/lib/libgmpdylib: Mach-0 64-bit dynamically linked shared
library x86_64

>
> If it doesn't have an i386 variant, reinstall the gmp library from
> MacPorts:

But I only need that if I want to run the 32 bit version of Python
from python.org. If I'm willing to use the 64 bit version from
macports, I don't care, right?

>
> $ sudo port selfupdate    # make sure MacPorts is up-to-date
> $ sudo port clean gmp
> $ sudo port install gmp +universal     # install 32-/64-bit variants
>
> Second, you need to install the MacOSX10.4u SDK because the current
> python.org pythons are built with it.

Then I'll just not use the download from python.org. Is there a way
to uninstall that disk image?

> That SDK is included in the Snow
> Leopard Xcode installer package but it is not installed by default.  
> There should be an Xcode.mpkg somewhere, perhaps on your hard disk if
> your system came with Snow Leopard factory-installed or perhaps on a
> restore DVD.  If not, it's on the retail Snow Leopard DVD and can be
> downloaded from the Apple Developer site.  After launching the Xcode
> installer, just select and install the "Mac OS 10.4 Support" package
> from the Custom Install menu.
>
> Third, you need to tell Distutils to use the older gcc-4.0 instead of
> the gcc-4.2 which is now the default on 10.6.
>
> $ cd /path/to/gmpy-1.11rc1
> $ export CC=/usr/bin/gcc-4.0
> $ /usr/local/bin/python3.1 setup.py install
> ...
> $ /usr/local/bin/python3.1 test3/gmpy_test.py
> Unit tests for gmpy 1.11
>     on Python 3.1.1 (r311:74543, Aug 24 2009, 18:44:04)
> [GCC 4.0.1 (Apple Inc. build 5493)]
> Testing gmpy 1.11 (GMP 4.3.1), default caching (100, 128)
> ...
> 1500 tests in 42 items.
> 1500 passed and 0 failed.

It would appear that all the above is unnecessary, as I have
64 bit Python from macports working with the 64 bit version
of gmpy compiled by macports. Not only does it pass the unit
test, but since it's 64 bits, I can reach beyond the "outrageous
exponent error" that I've seen in 32 bit Windows versions. I'm
told that gmp can't do more than 48 billion decimal digits, so I
now hit that restriction before I reach the next level of
"outrageous exponent".

I just won't be able to properly run IDLE, but as I said, that's
expendable.

Anyway, thanks for pointing that out, didn't realize the python.org
disk image was 32 bits. There was no point in downloading it at all.

As I pointed out in the thread "the need for 64 bits", once I've
seen Paris, there's no going back.

>
> --
>  Ned Deily,
>  n... at acm.org




More information about the Python-list mailing list