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: Giovanni Marco Dall'Olio
Subject: Re: [igraph] distributing a python library that uses igraph 0.6 as dependency
Date: Wed, 13 Nov 2013 22:25:17 +0100

Thank you very much for your answer, and sorry for such a long delay in answering.

In the end I am trying to build a binary package using pyinstaller, because I need to reach a broad audience if possible.

Do you have any suggestions about building binaries using igraph? I need to prepare at least some packages for Linux and Mac systems.
I can successfully build my script using pyinstaller, but then when I run the executable it complains that can't find the '_igraph' module.

$: ./dist/vcf2network
Traceback (most recent call last):
  File "<string>", line 8, in <module>
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/loader/pyi_importers.py", line 270, in load_module
    exec(bytecode, module.__dict__)
  File "/home/gioby/workspace/vcf2networks/build/vcf2network/out00-PYZ.pyz/binary_to_network", line 11, in <module>
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/loader/pyi_importers.py", line 270, in load_module
    exec(bytecode, module.__dict__)
  File "/home/gioby/workspace/vcf2networks/build/vcf2network/out00-PYZ.pyz/GenotypeNetwork", line 9, in <module>
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/loader/pyi_importers.py", line 270, in load_module
    exec(bytecode, module.__dict__)
  File "/home/gioby/workspace/vcf2networks/build/vcf2network/out00-PYZ.pyz/igraph", line 34, in <module>
ImportError: No module named _igraph

I suspect that it doesn't find the igraph C headers, but I am not sure how I can tell him where to find them.



On Fri, Nov 1, 2013 at 11:05 PM, Tamás Nepusz <address@hidden> wrote:
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




--
Giovanni Marco Dall'Olio, PhD
IBE, Institut de Biologia Evolutiva, CEXS-UPF (Barcelona, Spain)

My blog on bioinformatics: http://bioinfoblog.it

reply via email to

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