1

I installed igraph for python in my mac but I can't import it. First I installed C core library, then I proceeded with the instalation for python, by doing:

python setup.py build
python setup.py install

Everything seemed to work fine but I can't import igraph from python shell. Just to clear up, I'm not inside igraph source code's folder. And I got this error:

import igraph
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.3-fat/egg/igraph/__init__.py", line 30, in <module>

  File "build/bdist.macosx-10.3-fat/egg/igraph/core.py", line 7, in <module>
  File "build/bdist.macosx-10.3-fat/egg/igraph/core.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/*****/.python-eggs/python_igraph-0.5.4-py2.7-macosx-10.3-fat.egg-tmp/igraph/core.so, 2): Symbol not found: _igraph_vector_destroy
  Referenced from: /Users/*****/.python-eggs/python_igraph-0.5.4-py2.7-macosx-10.3-fat.egg-tmp/igraph/core.so
  Expected in: dynamic lookup

I replaced my folder's name for *, so don't consider it.

I'm running python 2.7 over OS 10.6.7. So there's no pre-compiled version of igraph avaliable (2.5 and 2.6 only). Has this error anything to do with the python version I'm running? If possible, how can I work this out?

Paulo
  • 267
  • 4
  • 14
  • Where did you install the C core of igraph? Is it in some standard location where the linker can find it? Do you have any other installations of the core library (older versions) lying around on your machine that can confuse the linker? – Tamás Jul 07 '11 at 08:24
  • Actually I don't have a previous intallation of core library. I think C core was intalled in a standard location 'cause I didn't specified any. I just did: `./configure` then `make`and then `make install` (). Where am I suppose to install it? If it's to change the installation location how can I set a path to C core be installed in and how I delete the one I installed in the wrong directory? (I'm a beginner at mac, sorry) – Paulo Jul 07 '11 at 13:17
  • The usual ``./configure && make && make install`` dance should install igraph in ``/usr/local/lib/libigraph.dylib``, and that should be fine. Are you sure that the version number of the igraph core you have downloaded and compiled matches the version number of the Python interface? – Tamás Jul 07 '11 at 13:44
  • I've downloaded and installed the last version avaliable at sourceforge which is 0.5.4. The version number of my Python interface is 2.7. – Paulo Jul 08 '11 at 19:12

1 Answers1

1

I think the problem is that igraph is installed in /usr/local/lib/libigraph.dylib, but the linker cannot find it when Python tries to load the C core of the igraph module because /usr/local/lib is not on the default library path in Mac OS X. (At least I think so).

First, please check whether libigraph.dylib is really in /usr/local/lib - it should be there. After that, try this:

DYLD_LIBRARY_PATH=/usr/local/lib python -m igraph.test.__init__

This should instruct the linker to look around in /usr/local/lib as well as the default places, and then run Python with the entire igraph test suite.

Tamás
  • 47,239
  • 12
  • 105
  • 124
  • Great. If you want to persist these changes, edit your ``.profile`` file in your home directory like this: ``export DYLD_LIBRARY_PATH=/usr/local/lib``. – Tamás Jul 09 '11 at 15:55