graph-tool 1.1.2 on macbook with mac os 10.4.11

Hi Tiago,

Hi Tiago,

Try the link with -lbz2 and -lz. You can set LDFLAGS to "-lbz2 -lz"
when issuing configure. I don't know why it is trying to link to
those libraries directly, since graph_tool uses them only through
boost_iostreams, and we're making a dynamic library. I suspect this
must be related either to the way things are linked in MacOS X, or
maybe how things are installed on your system, I'm not sure. If this
works, I'll add "-lbz2 -lz" to graph_tool build by default, since it
doesn't really hurt.

This looked better:
(cd .libs && rm -f libgraph_tool.la && ln -s ../libgraph_tool.la
libgraph_tool.la)
Making all in graph_tool
make[3]: Nothing to be done for `all'.
Making all in .
make[3]: Nothing to be done for `all-am'.
make[2]: Nothing to be done for `all-am'.
But, when I did 'graph-tool --help', here's what I got:
   File "/opt/local/bin/graph-tool", line 128
     return "|".join(metavars) if len(metavars) > 0 else None
                                ^
SyntaxError: invalid syntax

Are you sure you are using python 2.5? What is the result of 'python
--version'?

'python -V' gives 'Python 2.3.5'. 'which python' gives '/usr/bin/
python', which is a symbolic link to '/usr/bin/python2.3'.

The version I'd like to use is '/opt/local/bin/python2.5'. That's why
in configure options I set 'PYTHON_VERSION=2.5'. According to
'configure --help', "This string will be appended to the Python
interpreter canonical name.". If it did that and called 'python2.5'
it would execute the desired version, because 'opt/local/bin/' in in
PATH earlier than '/usr/bin/'.

Anyhow, I changed the '/usr/bin/python' symbolic link to point to '/
opt/local/bin/python2.5' and here's what I got:

/opt/local/lib/python2.5/site-packages/graph_tool/__init__.py:40:
RuntimeWarning: Python C API version mismatch for module
libgraph_tool: This Python has API version 1013, module libgraph_tool
has version 1012.
   import libgraph_tool
Traceback (most recent call last):
   File "/opt/local/bin/graph-tool", line 19, in <module>
     from graph_tool import *
   File "/opt/local/lib/python2.5/site-packages/graph_tool/
__init__.py", line 45, in <module>
     import os, os.path, re, struct, fcntl, termios, gzip, bz2, string,\
   File "/opt/local/lib/python2.5/gzip.py", line 9, in <module>
     import zlib
ImportError: No module named zlib

I'm attaching config.log, which in my inexperienced eyes looks to be
using python2.5 in /opt/local.

Cheers,

Spiros

config.log (87.6 KB)

But, when I did 'graph-tool --help', here's what I got:
   File "/opt/local/bin/graph-tool", line 128
     return "|".join(metavars) if len(metavars) > 0 else None
                                ^
SyntaxError: invalid syntax

Are you sure you are using python 2.5? What is the result of 'python
--version'?

'python -V' gives 'Python 2.3.5'. 'which python' gives
'/usr/bin/python', which is a symbolic link to '/usr/bin/python2.3'.

The version I'd like to use is '/opt/local/bin/python2.5'. That's why
in configure options I set 'PYTHON_VERSION=2.5'. According to
'configure --help', "This string will be appended to the Python
interpreter canonical name.". If it did that and called 'python2.5' it
would execute the desired version, because 'opt/local/bin/' in in PATH
earlier than '/usr/bin/'.

This is valid only for the build process, so that the module gets
installed in the correct place. However, all python scripts call only
"python" (you can check this for other python scripts in your system),
otherwise scripts would be tied to a particular python version. Of
course, you could also run 'python2.5 /opt/local/bin/graph-tool' to call
it by hand with the correct python version.

Anyhow, I changed the '/usr/bin/python' symbolic link to point to
'/opt/local/bin/python2.5' and here's what I got:

/opt/local/lib/python2.5/site-packages/graph_tool/__init__.py:40:
RuntimeWarning: Python C API version mismatch for module
libgraph_tool: This Python has API version 1013, module libgraph_tool
has version 1012.

It looks like the libpython you have installed on your system belongs to
a different version than graph_tool was compiled. You can check which
version was used by looking at the libgraph_tool.so module:

    ldd /opt/local/lib/python2.5/site-packages/graph_tool/libgraph_tool.so

(I assume this is the correct path on your system...)

  import libgraph_tool
Traceback (most recent call last):
  File "/opt/local/bin/graph-tool", line 19, in <module>
    from graph_tool import *
  File "/opt/local/lib/python2.5/site-packages/graph_tool/__init__.py",
line 45, in <module>
    import os, os.path, re, struct, fcntl, termios, gzip, bz2, string,\
  File "/opt/local/lib/python2.5/gzip.py", line 9, in <module>
    import zlib
ImportError: No module named zlib

Notice this an error from the standard python module "gzip", which tries
to load the "zlib" module and fails. This module should be there, since
it is also a standard python module. It looks like there's something
wrong with your python installation.

I'm attaching config.log, which in my inexperienced eyes looks to be
using python2.5 in /opt/local.

Yes, it uses that to install the module in the correct place, and to
link to the correct python library. But it has
nothing to do with the runtime environment... If you have python 2.3
installed as default, it is going to use that.

Cheers,
Tiago

Hi Tiago,

It looks like there's something
wrong with your python installation.

You are right, of course. Python on Mac OS X is supposed to be
installed as a 'framework'. I'll pretend to understand what this
means by saying it's some kind of special library. So, I did the
framework installation of Python. Now it looks like that you can no
longer link to Python with '-lpython2.5' but you need to use '-
framework Python' instead. Here's what the 'ld' man says:

" -framework name[,suffix]
               Specifies a framework to link against. Frameworks
are dynamic
               shared libraries, but they are stored in different
locations,
               and therefore must be searched for differently. When
this option
               is specified, ld searches for framework
`name.framework/name'
               first in any directories specified with the -F
option, then in
               the standard framework directories /Library/
Frameworks, /Net-
               work/Library/Frameworks, and /System/Library/
Frameworks. The
               placement of the -framework option is significant, as
it deter-
               mines when and how the framework is searched. If
the optional
               suffix is specified the framework is first searched
for the name
               with the suffix and then without.
"

As you can understand, ./configure fails now with:

checking for Python library path... -L/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5 -lpython2.5
checking for Python site-packages path... /Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/site-packages
checking python extra libraries... -ldl
checking python extra linking flags... -u _PyMac_Error
Python.framework/Versions/2.5/Python
checking consistency of all components of python development
environment... no
configure: error:
   Could not link test program to Python. Maybe the main Python
library has been
   installed in some non-standard library path. If so, pass it to
configure,
   via the LDFLAGS environment variable.
   Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"

Spiros Spirou <spiros.spirou(a)ucl.ac.uk> writes:

Hi Tiago,

It looks like there's something
wrong with your python installation.

You are right, of course. Python on Mac OS X is supposed to be
installed as a 'framework'. I'll pretend to understand what this
means by saying it's some kind of special library. So, I did the
framework installation of Python. Now it looks like that you can no
longer link to Python with '-lpython2.5' but you need to use '-
framework Python' instead. Here's what the 'ld' man says:

[...]

Could you please tell me how/where to make the change so that it uses
-framework instead of -l?

Did you try setting LDFLAGS to "-framework Python"? The autotools
framework uses libtool to link everything together. There should be more
general steps to compile things for MacOS, though I'm not familiar with
them. Did you check FINK?

Best regards,
Tiago

Hi Tiago,

Spiros Spirou <spiros.spirou(a)ucl.ac.uk> writes:

Could you please tell me how/where to make the change so that it uses
-framework instead of -l?

Did you try setting LDFLAGS to "-framework Python"?

Yes I did, but ./configure still fails when it tries to test linking
to the python lib.

The autotools
framework uses libtool to link everything together. There should be
more
general steps to compile things for MacOS, though I'm not familiar
with
them. Did you check FINK?

Will do.

Thanks,

Spiros

Spiros-

Have you tried installing Linux on a spare box? I hear it fixes most of
these endless and pesky issues on OS X. I've spent far more time than
I'd like to recall trying to get various FLOSS tools and libraries I use
to work on OS X, and I have no plans to head back to the platform
anytime soon.

Cheers,
Cyrus

Cyrus Hall <hallc(a)lu.unisi.ch> writes:

Spiros-

Have you tried installing Linux on a spare box? I hear it fixes most
of these endless and pesky issues on OS X. I've spent far more time
than I'd like to recall trying to get various FLOSS tools and
libraries I use to work on OS X, and I have no plans to head back to
the platform anytime soon.

GNU/Linux can easily be installed on a MacBook as well, side by side
with MacOS X. In fact I that's exactly what I have.

However, in princible, being MacOS X a darwin/bsd system in disguise, it
should be possible to install most stuff on it. If I'm not mistaken,
that's what the whole FINK project is about. But despite having it on my
machine, I have no experience installing anything on MacOS X, except for
firmware upgrades, and I'm a bit short on time to experiment. Let's see
what Spiros is able to accomplish. :slight_smile:

Cheers,
Tiago

Hi Cyrus,

Hi Tiago,