Re: PIL (etc etc etc) on OS X

Discussion in 'Python' started by Kevin Walzer, Aug 1, 2008.

  1. Kevin Walzer

    Kevin Walzer Guest

    David C. Ullrich wrote:
    > Decided to try to install PIL on my Mac (OS X.5).


    OK, sounds good.
    >
    > I know nothing about installing programs on Linux,
    > nothing about building C programs, nothing about
    > installing libraries, nothing about "fink", nothing
    > about anything. Please insert question marks after
    > every sentence:


    For the record, OS X isn't Linux--it's a variant of BSD Unix. Similar,
    but no identical, to Linux.

    >
    > I saw a "BUILDME" with instructions "for lazy programmers".
    > I did that. It seems that everything worked except a
    > jpg library is missing.


    OK.

    >
    > I read that I need to install libjpeg. I read that on OS X
    > this is "usually" done using fink. Great:
    >
    > (i) The idea of installing fink scares me, for no reason
    > I could name. There's no way that's going to confuse the
    > rest of Darwin, right?


    You don't really need Fink just to install libjpeg. You do need the
    developer tools (Xcode) installed, otherwise you can't build any
    software at all.

    Libjpeg can be downloaded from http://www.ijg.org/. Download it,
    untar/unzip it. Fire up terminal, cd to the libjpeg directory, and type
    these commands:

    configure
    make
    sudo make install

    That should get libjpeg built and installed.

    >
    > (ii) When I look at the fink website I see a list of
    > supported libraries, not including libjpeg.


    So don't worry about Fink.

    >
    > I hate messing with things that I don't understand at _all_...


    Well, that's understandable, but this is your chance to learn something
    new.
    >
    > Thanks for any advice or comments.
    >
    > DU.
    >

    --Kevin

    --
    Kevin Walzer
    Code by Kevin
    http://www.codebykevin.com
    Kevin Walzer, Aug 1, 2008
    #1
    1. Advertising

  2. Kevin Walzer

    Kevin Walzer Guest


    > First, it occurred to me that I've got wxPython installed
    > and it includes jpeg support. I don't suppose that means that
    > wxPython has already put a libjpeg somewhere and I just
    > need to tell PIL where it is?


    I doubt it. You're probably better off building libjpeg yourself.
    >
    >
    > Presumably jibjpeg needs to be unzipped into its own
    > directory, or configure/make etc wouldn't be able to
    > figure out what I want to make. Presumably that happens
    > automatically when I unzip it.


    Yes.
    >
    > Then after I do the configure/make/sudo make install will
    > libjpeg automatically be in some standard place? If not,
    > what's a good choice of standard place to put it, and
    > how do I put it there? (If I start here then it will
    > unzip to there, and then after I make it there it will
    > be installed in this third place, which is where I want
    > it.)


    I think, by default, that it installs in /usr/local/lib. You can run
    configure --help in the libjpeg directory and it will give you a rundown
    of the various options, including where to install libjepg if you want a
    different place.


    >
    > Thanks. Sorry to be so dumb - yes, it's perfectly reasonable
    > for eff to assume that people using PIL are programmers.
    > With a "new thing" in, say, Python I'd just try something
    > and then figure out what to try next to make it work - I
    > don't want to take that approach here lest I re-make
    > part of Darwin or something. Once many years ago I
    > learned a new thing: Attempting to run a sufficiently
    > invalid DOS exe could cause physical damage to a hard
    > drive... that wasn't the only thing I learned that day.


    /usr/local is a good place to install stuff in a way that won't disrupt
    your system. OS X/Darwin puts its system stuff in /usr/bin, /usr/lib,
    and so on.

    --Kevin

    --
    Kevin Walzer
    Code by Kevin
    http://www.codebykevin.com
    Kevin Walzer, Aug 2, 2008
    #2
    1. Advertising

  3. Kevin Walzer

    Kevin Walzer Guest

    David C. Ullrich wrote:
    > Just as well that the message sent earlier today
    > seems to have been lost...
    >
    > Ok. Read your instructions on libjpeg. Read some
    > of the install.doc. ./configure, fine. make, fine.
    > "make test", fine. So I said "sudo make install"
    > and this happened:
    >
    > 0-1d-4f-fc-28-d:jpeg-6b dullric$ sudo make install
    > Password:
    > /usr/bin/install -c cjpeg /usr/local/bin/cjpeg
    > /usr/bin/install -c djpeg /usr/local/bin/djpeg
    > /usr/bin/install -c jpegtran /usr/local/bin/jpegtran
    > /usr/bin/install -c rdjpgcom /usr/local/bin/rdjpgcom
    > /usr/bin/install -c wrjpgcom /usr/local/bin/wrjpgcom
    > /usr/bin/install -c -m 644 ./cjpeg.1 /usr/local/man/man1/cjpeg.1
    > /usr/bin/install -c -m 644 ./djpeg.1 /usr/local/man/man1/djpeg.1
    > /usr/bin/install -c -m 644 ./jpegtran.1 /usr/local/man/man1/jpegtran.1
    > /usr/bin/install -c -m 644 ./rdjpgcom.1 /usr/local/man/man1/rdjpgcom.1
    > /usr/bin/install -c -m 644 ./wrjpgcom.1 /usr/local/man/man1/wrjpgcom.1
    >
    > Surely that means it was installed in /usr/local/bin, right?
    >
    > So I start over with PIL. It says I should "python setup.py build_ext
    > -i".
    > So I do:
    >
    > 0-1d-4f-fc-28-d:Imaging-1.1.6 dullric$ python setup.py build_ext -i
    > running build_ext
    > --- using frameworks at /System/Library/Frameworks
    > --------------------------------------------------------------------
    > PIL 1.1.6 BUILD SUMMARY
    > --------------------------------------------------------------------
    > version 1.1.6
    > platform darwin 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
    > [GCC 4.0.1 (Apple Inc. build 5465)]
    > --------------------------------------------------------------------
    > --- TKINTER support ok
    > *** JPEG support not available
    > --- ZLIB (PNG/ZIP) support ok
    > --- FREETYPE2 support ok
    > --------------------------------------------------------------------
    > To add a missing option, make sure you have the required
    > library, and set the corresponding ROOT variable in the
    > setup.py script.
    >
    > So I look in setup.py and I find this:
    >
    > # Library pointers.
    > #
    > # Use None to look for the libraries in well-known library locations.
    > # Use a string to specify a single directory, for both the library and
    > # the include files. Use a tuple to specify separate directories:
    > # (libpath, includepath). Examples:
    > #
    > # JPEG_ROOT = "/home/libraries/jpeg-6b"
    > # TIFF_ROOT = "/opt/tiff/lib", "/opt/tiff/include"
    > #
    > # If you have "lib" and "include" directories under a common parent,
    > # you can use the "libinclude" helper:
    > #
    > # TIFF_ROOT = libinclude("/opt/tiff")
    >
    > FREETYPE_ROOT = None
    > JPEG_ROOT = None
    > #JPEG_ROOT = "/usr/local/bin"
    >


    How about "/usr/local/lib" ? It's looking for a dylib (library file),
    not an executable (bin).


    --
    Kevin Walzer
    Code by Kevin
    http://www.codebykevin.com
    Kevin Walzer, Aug 4, 2008
    #3
  4. David C. Ullrich wrote:
    > Just as well that the message sent earlier today
    > seems to have been lost...
    >
    > Ok. Read your instructions on libjpeg. Read some
    > of the install.doc. ./configure, fine. make, fine.
    > "make test", fine. So I said "sudo make install"
    > and this happened:
    >
    > 0-1d-4f-fc-28-d:jpeg-6b dullric$ sudo make install
    > Password:

    [...]

    I had to do the following to build and install it in a way such that PIL would recognise
    it. But it does now, without changing anything in PIL's setup files.

    $ cd jpeg-6b/
    $ ln -s `which glibtool` libtool
    $ export MACOSX_DEPLOYMENT_TARGET=10.4
    $ ./configure --enable-shared --enable-static --host=powerpc
    $ make
    $ sudo make install


    (note that I have a PPC mac so the host parameter may not be correct for your system)
    --irmen
    Irmen de Jong, Aug 5, 2008
    #4
  5. David C. Ullrich wrote:

    > Thanks. Sorry to be so dumb - yes, it's perfectly reasonable
    > for eff to assume that people using PIL are programmers.


    well, my only assumption is that people building PIL from basic building
    blocks must have some understanding of how that's done on their
    specific platform (and I don't have that knowledge myself for all
    platforms). And OS X can be something of a mess; search for "OS X" in
    the image-sig archives for a lot more on this.

    </F>
    Fredrik Lundh, Aug 13, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robin Cull
    Replies:
    5
    Views:
    401
    Andrew Dalke
    Jul 31, 2003
  2. Daniel Joyce

    Python Audio (Alpy, Fastaudio, Etc Etc)

    Daniel Joyce, Sep 16, 2003, in forum: Python
    Replies:
    1
    Views:
    917
    Markus Wankus
    Sep 16, 2003
  3. Marco Herrn
    Replies:
    7
    Views:
    625
    Ng Pheng Siong
    Apr 9, 2004
  4. rodmc
    Replies:
    2
    Views:
    378
    Max Erickson
    Jan 3, 2006
  5. Sverre
    Replies:
    2
    Views:
    3,542
    Sverre
    Dec 17, 2009
Loading...

Share This Page