Skip to content

Instantly share code, notes, and snippets.

@kpj
Last active July 2, 2019 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kpj/fc5570b9ebd77644c49739a340de42db to your computer and use it in GitHub Desktop.
Save kpj/fc5570b9ebd77644c49739a340de42db to your computer and use it in GitHub Desktop.
Compile and install the latest version of python-igraph
set -eu
#https://github.com/igraph/python-igraph/issues/157
#https://github.com/Homebrew/homebrew-core/blob/master/Formula/igraph.rb
#https://github.com/gephi/gephi/wiki/GraphStreaming#Server_Module
wd="tmp"
rm -rf "$wd" && mkdir "$wd"
cd "$wd"
# get python-package source
git clone https://github.com/igraph/python-igraph/
cd python-igraph
# retrieve and compile igraph C-core
git clone https://github.com/igraph/igraph igraphcore
cd igraphcore
./bootstrap.sh
mkdir _build && cd _build
../configure --prefix=$PWD/../_install
make -j4
make install
cd ../../
# install python package
# `--prefix=` is a fix for "error: can't combine user with prefix, exec_prefix/home, or install_(plat)base"
CPPFLAGS=-I$PWD/igraphcore/_install/include/igraph \
LDFLAGS=-L$PWD/igraphcore/_install/lib \
PKG_CONFIG_PATH=igraphcore/_install/lib/pkgconfig/ \
python3 setup.py install --user --prefix=
@dav22297
Copy link

dav22297 commented Jul 10, 2018

I tried to run the script but i get following result:

Cloning into 'python-igraph'...
remote: Counting objects: 7754, done.
remote: Total 7754 (delta 0), reused 0 (delta 0), pack-reused 7754
Receiving objects: 100% (7754/7754), 21.95 MiB | 1.71 MiB/s, done.
Resolving deltas: 100% (5893/5893), done.
Checking connectivity... done.
Cloning into 'igraphcore'...
remote: Counting objects: 58358, done.
remote: Total 58358 (delta 0), reused 0 (delta 0), pack-reused 58357
Receiving objects: 100% (58358/58358), 109.38 MiB | 2.20 MiB/s, done.
Resolving deltas: 100% (45170/45170), done.
Checking connectivity... done.
Finding out version number/string... 0.8.0-pre+c517ad2

  • aclocal
    ./bootstrap.sh: 17: ./bootstrap.sh: aclocal: not found
  • /usr/bin/libtoolize --force --copy
    libtoolize: putting auxiliary files in '.'.
    libtoolize: copying file './ltmain.sh'
    libtoolize: You should add the contents of the following files to 'aclocal.m4':
    libtoolize: '/usr/share/aclocal/libtool.m4'
    libtoolize: '/usr/share/aclocal/ltoptions.m4'
    libtoolize: '/usr/share/aclocal/ltsugar.m4'
    libtoolize: '/usr/share/aclocal/ltversion.m4'
    libtoolize: '/usr/share/aclocal/lt~obsolete.m4'
    libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
    libtoolize: and rerunning libtoolize and aclocal.
    libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
  • autoheader
  • automake --add-missing --copy
    ./bootstrap.sh: 20: ./bootstrap.sh: automake: not found
  • autoconf
    configure.ac:3: error: possibly undefined macro: AM_INIT_AUTOMAKE
    If this token and others are legitimate, please use m4_pattern_allow.
    See the Autoconf documentation.
    configure.ac:37: error: possibly undefined macro: AM_PROG_LEX
    configure.ac:43: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
    configure.ac:44: error: possibly undefined macro: AC_LIBTOOL_DLOPEN
    configure.ac:45: error: possibly undefined macro: AC_PROG_LIBTOOL
    configure.ac:46: error: possibly undefined macro: AM_MISSING_PROG
    configure.ac:328: error: possibly undefined macro: AM_CONDITIONAL
  • patch -N -p0 -r-
  • true
    ../configure: line 2425: syntax error near unexpected token foreign' ../configure: line 2425: AM_INIT_AUTOMAKE(foreign subdir-objects)'

Could you help me please? I am using Ubuntu 16.04.

@kpj
Copy link
Author

kpj commented Aug 5, 2018

The main problem seems to be, that you are missing some dependencies.
I don't use Ubuntu, so I cannot give you the exact solution, but something along the following should get you started:

apt install autotools-dev aclocal automake

(source: https://askubuntu.com/questions/45480/how-do-i-install-aclocal)

@bkovitz
Copy link

bkovitz commented Jul 1, 2019

Many thanks! I just ran your script and successfully installed python-igraph on an old MacOS: 10.7. I would have given up if it weren't for your script.

I'm not 100% sure, but I think I had to do one thing differently: the cd - on line 23 seems to go back to the tmp/igraphcore directory, but the last command needs to be run from the tmp directory.

BTW, is it OK to delete the tmp directory once the installation is complete?

@kpj
Copy link
Author

kpj commented Jul 2, 2019

Wonderful! I am glad to hear it was of help.

And you are very correct, I replaced line 23 with cd ../../.

If you have successfully installed the Python package to another directory, it should be fine to get rid of tmp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment