On 25 May 2010 15:39, Tony Theodore <to...@logyst.com> wrote:
> On 25 May 2010 13:23, Brandt Belson <bbel...@princeton.edu> wrote:
>> Hi again,
>> Ok, I installed numexpr and the newest Cython, and now the latest trunk
>> version gives another error related to hdf5.
>
> [...snip]
>
>> .. ERROR:: Could not find a local HDF5 installation.
>>    You may need to explicitly state where your local HDF5 headers and
>>    library can be found by setting the ``HDF5_DIR`` environment
>>    variable or by using the ``--hdf5`` command-line option.
>> error: Setup script exited with 1
>> I have set the HDF5_DIR env variable to the right value, along with
>
> [snip...]
>
> Most of what you're doing looks like it should work. You seem to be
> using python from python.org and distutils is calling gcc4.0.
>
> There are some things I'd try:
>
> Check output of gcc -v. If it's 4.2 it will default to buidling a
> 64-bit hdf5 that won't be usable. You'll have to specify either -arch
> i386 or CC when configuring.
>
> Use the file command to determine the archs of
> ../hdf5-1.8.4/hdf5/lib/libhdf5.dylib (or similar).
>
> Try installing hdf5 to /usr/local, I've generally had the most success
> with this.
>
> I'm not at a Mac at the moment, I'll have a look later on.

Ok, so I think I've figured out a simple general approach, but haven't
tested it. The main problem is the mix of available python
interpreters and different arch defaults for compilers.

Check python arch:

[1] $ file `which python`
/Library/Frameworks/Python.framework/Versions/Current/bin/python:
Mach-O executable i386

For comparison, the Apple supplied python:

[2] $ file /usr/bin/python
/usr/bin/python: Mach-O universal binary with 3 architectures
/usr/bin/python (for architecture x86_64):      Mach-O 64-bit executable x86_64
/usr/bin/python (for architecture i386):        Mach-O executable i386
/usr/bin/python (for architecture ppc7400):     Mach-O executable ppc

In the case of [1], you're lucky, you simply need to compile an i386
library. Configure hdf5 (and any others - lzo, szip etc) as follows:

env CC=gcc-4.0 ./configure --prefix=/usr/local

Using /usr/local is reasonably fail-safe; you don't need to pass
anything else to pytables, specify library paths, and
easy_install/distutils can find it. Setting CC is the quick way to get
a default i386 binary, you could also specify CFLAGS='-arch i386' and
LDFLAGS='-arch i386'. You can also pass  --enable-shared
--disable-static to configure if you like.

I believe the the python.org version is a universal i386/ppc binary,
so the same applies.

In the case where the python on your path includes x86_64, you have to
know a little more about what changes you've made to the system. On a
vanilla system with just OSX and XCode, the following should work for
hdf5:

./configure --prefix=/usr/local

If you've been playing with paths, defaults write *.* Prefer-32-Bit,
gcc versions etc., you'll probably want to reverse those changes and
force an x86_64 build:

env CC=gcc-4.2 ./configure --prefix=/usr/local

or

env CC=gcc-4.2 CFLAGS='-arch x86_64' LDFLAGS='-arch x86_64'
./configure --prefix=/usr/local

I've never been able to get an i386 build working with an x86_64
python, I'm sure it's possible, but I'd need to know a lot more about
universal binaries and distutils than I have time for.

After installing hdf5, confirm:

$ file /usr/local/lib/libhdf5.dylib

is the correct arch.

Once that is done, the various ways of installing pytables (tarball,
svn, easy_install) usually "just work".

Hope that helps, I'll try and put some notes on the wiki since this
comes up often.

Tony

------------------------------------------------------------------------------

_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to