igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] pip install python-igraph error?


From: Tamas Nepusz
Subject: Re: [igraph] pip install python-igraph error?
Date: Wed, 27 May 2015 22:48:23 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

Hi Nick,

I have researched this problem a bit tonight and here's what I found out. These
are very technical details and might not help a lot at this stage, but
I thought I'd send them to the mailing list anyway in case someone else is
struggling with the same problem and finds this thread.

The core of the problem is as follows. igraph needs to link to libxml2 to
support reading GraphML files. When you install Anaconda Python, it brings its
own copy of libxml2 in ~/anaconda/lib. Now, when igraph tries to figure out how
to link to libxml2, it invokes an executable named xml2-config, which is
supposed to print out the compiler and linker flags necessary to link to
libxml2.

OS X does not ship xml2-config by default, so in case of OS X, we fall back to
an "educated guess" during the compilation phase, and this seems to work
nicely. However, Anaconda Python ships its *own* copy of xml2-config, so igraph
invokes Anaconda's xml2-config and uses the compiler and linker flags from
there. For sake of comparison, these are the linker flags proposed by
xml2-config in Anaconda Python:

-L${HOME}/anaconda/lib -lxml2 -lz -liconv -lm

and this is our "educated guess" that we would have used in case of a missing
xml2-config:

-lxml2

Now, when the linker sees the flags suggested by Anaconda's libxml2-config, it
tries to use the libxml2 library from Anaconda Python (since Anaconda's lib
directory is inserted at the front of the library path), and subsequently it
reads ${HOME}/anaconda/lib/libxml2.la to figure out libxml2's dependencies.
libxml2.la references /usr/lib/libiconv.la, which does not exist on OS X, and
the compilation fails.

On my machine, the compilation worked even with Anaconda Python installed
because I did _not_ have Anaconda's bin directory (i.e. ${HOME}/anaconda/bin)
on my path (deliberately), so the compilation phase of igraph did _not_ find
Anaconda's xml2-config executable and used the "educated guess" instead. This
made igraph link to the copy of libxml2 provided by OS X instead of libxml2
provided by Anaconda Python, and I'm a bit unsure whether this could lead to
further problems down the road (probably not), but the bottom line is that the
compilation succeeded.

At the moment, there are three workarounds:

#1) Temporarily rename Anaconda's xml2-config to something else before
installing igraph using "pip install python-igraph" so it is not found during
the compilation phase. igraph will then link to libxml2 provided by OS X.

#2) Patch ~/anaconda/lib/libxml2.la so it does not refer to
/usr/lib/libiconv.la. I haven't tried this, but it would probably work.

#3) Compile igraph's C core independently from Homebrew (http://brew.sh, using
"brew install igraph"), and then try "pip install python-igraph". In this case,
"pip install python-igraph" will find the copy of igraph's core C library from
Homebrew and does not try to compile it on its own.

All the best,
Tamas

> But I should add: it's a completely clean OS and conda install, so I
> imagine whatever problem I'm running into isn't unique to me.
> 
> On Sun, May 24, 2015 at 1:51 PM Nick Eubank <address@hidden> wrote:
> 
> > (I'm on 10.10 if that matters)
> >
> > On Sun, May 24, 2015 at 1:51 PM Nick Eubank <address@hidden> wrote:
> >
> >> Thanks -- silly question, but any suggestions on how to trace that? Seems
> >> like a lot goes on in this install, and it's not explicitly in any
> >> options...
> >>
> >> Also interestingly, I seem to have the library, and even reinstalled it
> >> to no avail...
> >>
> >> On Sun, May 24, 2015 at 4:35 AM Tamas Nepusz <address@hidden> wrote:
> >>
> >>> Hi Nick,
> >>>
> >>> > Tried doing a new python-igraph install on a new computer with clean
> >>> > anaconda 2.7.3 install. Got:
> >>> > [...]
> >>> >     grep: /usr/lib/libiconv.la: No such file or directory
> >>> >     sed: /usr/lib/libiconv.la: No such file or directory
> >>> I have seen it a few times before -- it's quite common and not specific
> >>> to
> >>> igraph. (Googling for "missing libiconv.la" reveals quite a lot of
> >>> hits). Some
> >>> other .la file on your system (probably in /usr/lib, but maybe not) lists
> >>> /usr/lib/libiconv.la as a dependency even though it should not be
> >>> required. Try
> >>> to find out which other .la file refers to libiconv.la and then either
> >>> move
> >>> that file aside temporarily or remove libiconv.la temporarily from the
> >>> list of
> >>> dependencies in that other file.
> >>>
> >>> T.
> >>>
> >>> _______________________________________________
> >>> igraph-help mailing list
> >>> address@hidden
> >>> https://lists.nongnu.org/mailman/listinfo/igraph-help
> >>>
> >>

> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help


-- 
T.



reply via email to

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