igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] distributing a python library that uses igraph 0.6 as depen


From: Tamás Nepusz
Subject: Re: [igraph] distributing a python library that uses igraph 0.6 as dependency
Date: Fri, 1 Nov 2013 23:05:42 +0100

Hello,  

> The main problem is that one of the requirements of my suite is igraph 0.6, 
> which is based on the igraph 0.6 C library. This C library must be installed 
> manually, and I don't know how to define the dependency in the setup.py 
> script.
There is no way to define that because you can depend only on other Python 
packages within your setup.py script.
  
> With the previous 0.5.4 version, the C code was included in the igraph .egg 
> package

Are you sure about that? As far as I remember, I stopped shipping the source 
code of the C library with the Python interface starting from igraph 0.5.

> However, in the newer 0.6 version, the C library is not included anymore in 
> the igraph package on PyPI. What is the recommended procedure to distribute a 
> python package based on igraph 0.6?
Well, it depends on your target audience. For instance, will they have a C 
compiler on their machine so they can compile the C core of igraph if needed? 
Will they use a 32-bit or a 64-bit machine? What operating system will they 
use? What Python version?

If your package is targeting developers who should at least know what a C 
compiler and a C library is, then it should not be too complicated for them to 
install or compile the C core of igraph on their own, so I think it would be 
enough to declare a dependency on python-igraph in your setup.py and then add a 
README which states that the C core of igraph must be installed beforehand, 
either to a standard location or to a location where pkg-config is able to find 
it.

However, if you want your package to be easy to use by everyone, including 
people who have never seen a C compiler at all, then your best bet is probably 
to prepare a completely self-contained installer that installs a basic Python 
runtime and all the dependencies. Creating such an installer is outside the 
scope of a simple setup.py script, but it can be done with cx_Freeze or 
PyInstaller. The installer would then contain a pre-compiled version of igraph 
that you compiled on your machine. Chances are that you would need several 
virtual machines to do this for all the platforms you want to support. To be 
honest, it’s not an easy task at all.

In the meanwhile, I am working on making python-igraph more 
“easy_install”-friendly. Ideally, I want python-igraph to be installable simply 
by invoking “easy_install python-igraph” or “pip install python-igraph”, in 
which case python-igraph should check whether the C core is available and 
download (and compile and install) it as well if needed. Due to lack of time on 
my side, I don’t think it’s gonna happen any time soon, though.

All the best,
Tamas




reply via email to

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