[Pythonmac-SIG] Questions concerning OS X, Python, Tk, libraries, fink, and maybe some other things too...

Bob Ippolito bob at redivi.com
Mon Apr 19 00:13:02 EDT 2004


On Apr 18, 2004, at 11:40 PM, Kenneth McDonald wrote:

> The Problem
> -----------------
>
> OK, sorry for the broad scope of this question, but there are so many  
> things
> I'm _possibly_ doing wrong that it's hard to narrow it down :-)
>
> I am currently trying to get two Python/Tk related things working:
>
> 1) matplotlib with TkAgg, see  
> http://matplotlib.sourceforge.net/backends.html, and
> 2) Fred Lundh's Tkinter3000
>
> After a number of days of frustration, puzzling over gcc books, etc, I  
> have
> now advanced the installation of each of these packages to the point  
> where
> they are theoretically installed, and when I try to run either, the  
> following happens:
>
> 	# ...my command invoking matplotlib or Tkinter3000...
>
> 	Fatal Python error: Interpreter not initialized (version mismatch?)
> 	Abort
>
> Trust me, this is real progress over a few days ago! :-)

See http://www.pythonmac.org/wiki/FAQ, you have a non-System framework  
python installed, and it needs to go.

>
> What I've Tried
> --------------------
>
> To start off, here is what I've done to try to get things installed:
>
> 1) Set up the following environment variables, so that gcc
> can find libraries and sources it needs:
>
> setenv CPATH  
> /Library/Frameworks/Python.framework/Headers:/Library/Frameworks/ 
> Tk.framework/Headers:/Library/Frameworks/Tcl.framework/Headers:/usr/ 
> local/include
> setenv LD_LIBRARY_PATH  
> /Library/Frameworks/Python.framework:/Library/Frameworks/Tk.framework: 
> /Library/Frameworks/Tcl.framework:/usr/local/lib
> setenv LIBRARY_PATH  
> /Library/Frameworks/Python.framework:/Library/Frameworks/Tk.framework: 
> /Library/Frameworks/Tcl.framework:/usr/local/lib
>
> 1a) Copied libtk8.4.a from somewhere (I can't even remember
> from where) to the Tk Frameworks folder, so it would be on the
> library path. This was probably a Bad Thing, but I didn't know
> what else to do, and hey, things finally compiled! (Too bad they
> didn't work.)
>
> 2) Set up a /usr/local directory, and to it, copied a bunch of stuff
> from /sw/bin (which was installed using fink, and I gotta say,
> fink having its own special directory structure is a major PITA.
> Is there a way to get fink to use the standard UNIX structure?)
>
> 3) Installed a couple of other things (notably freetype2) manually.
>
> Doing the above allowed compilation and installation to complete,
> but as the Fatal Python error indicates, things are not quite
> working...
>
>
> Status of my System
> ----------------------------
>
> Currently, I have python and Tkinter using AquaTclTk installed and
> running on my system. By doing 'which python', following links,
> etc., I believe that my one and only python is the one in the
> Frameworks directory. (Well, there is another in a Jython directory,
> but I don't believe that is interfering with anything.) I'm running
> the most recent OS X 10.3

You have more than one Python 2.3 installed, or else you would not get  
a version mismatch.

> Questions
> --------------
>
> Aside from the obvious (how do I get it working!?), I was wondering
> if people would give suggestions on the following:
>
> 1) Is Fink worth using? So far, I've found that its use of a  
> nonstandard
> directory structure causes more harm than good. Any suggestions
> for making things less painful?

I don't like using it because it installs more junk than I actually  
want, puts itself first in the path, and makes it difficult to  
distribute self-contained software (because inevitably anything you  
build will link against something in /sw/lib).  I've heard good things  
about darwinports, but I have no experience with it.. I generally port  
the software myself if it doesn't already compile+install properly.

> 2) How should I organize my libraries? Should I maintain copies in
> both a UNIX-style directory structure and (where applicable) in
> a Frameworks structure, should I hand-configure the appropriate
> paths to include relevant Frameworks directories, should I create
> links, what?

It depends...  I personally use frameworks whenever possible and hack  
the build scripts or my environment to support them if necessary.

> 3) What the heck is a .dylib and how does it differ from a .so, _or_,
> should I care?

It's a LOT different.  I have a truly marvelous explanation of the  
differences, which however the margin is not large enough to contain :)

If you're particularly interested, here's some pointers:

man dyld
man ld
read the Mach-O runtime architecture documentation

> 4) If I'm trying to compile things that rely on Tk, does the fact that
> I'm using AquaTk mean I have to take special steps? (Things like
> BLT obviously cause problems, but my understanding is that BLT
> uses some X11-specific calls that haven't yet been implemented
> in whatever the smart AquaTclTk people are doing.)

I tried compiling something against TclTkAqua once or twice and failed.  
  I wouldn't wish it on my worst enemies.  I have significant experience  
with the idiosyncrasies of porting *NIX software to OS X, and I know  
the ins and outs of Mach-O, so if I didn't get it in an hour or two  
then the situation is pretty bleak.

-bob




More information about the Pythonmac-SIG mailing list