[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Python3 igraph import error on Cygwin

From: Tamás Nepusz
Subject: Re: [igraph] Python3 igraph import error on Cygwin
Date: Wed, 24 Apr 2013 20:45:17 +0200


> No such luck. The usual import error I get with a fresh install of igraph 
> from source is because the shared library isn't found because I forget to add 
> a /etc/ld.so.conf.d/igraph.conf file or update LD_LIBRARY_PATH. This is 
> different (though I admit I did still try LD_LIBRARY_PATH with 
> /usr/local/igraph/lib and even the egg/igraph directory, which contains a 
> .dll).
Okay, so the story is as follows. You should have a file named libigraph.so (or 
.dll, not sure what extension Cygwin uses) somewhere in your file system. This 
is the C core of igraph, and the folder that contains this file should be on 
your library path. If this folder is not /lib, /usr/lib or /usr/local/lib, 
chances are that you need to add this permanently to your LD_LIBRARY_PATH.

On top of libigraph.so, we have a glue layer that sits between the Python 
interface of igraph and the C core of igraph. This glue layer is the magic 
igraph._igraph module that Python is looking for, and it should be in the very 
same folder where the root __init__.py file of the Python interface is. (Should 
be right within the .egg directory). The glue layer is usually named 
_igraph.so, _igraph.dll, _igraph.pyd, _igraph.dylib or something like that, 
depending on your platform. (Again, I'm not sure which one Cygwin uses). The 
folder containing this file does not have to be added to LD_LIBRARY_PATH 
because Python will do that automatically when the igraph module is loaded, but 
the file should be there in the right place.

Please check that you have both of these files at the right places. The 
.egg-info file is not necessary as far as I know, it only contains metadata 
that makes it easier for distutils and/or pip to uninstall or upgrade the 

> I tried adding the egg directory to PYTHONPATH with no success. But the 
> original error suggests that it was already finding the module in the egg. 
> It's inside igraph/__init__.py when the import error occurs. But 
> igraph/_igraph.py is there too, which is why I'm lost why it's not finding it.
Is it really called _igraph.py and not _igraph.dll, _igraph.pyd or something 
like that? Also, another option is to try debugging what the dynamic library 
loader is actually doing when you try to import igraph. Try this:

LD_DEBUG=libs python3 -c "import igraph"

This will give you lots of information about what ld is doing (and you can get 
even more info with LD_DEBUG=all); the relevant section looks like this for me:

     25408:     calling init: /home/tamas/lib/libigraph.so.0
     25408:     calling init: 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]