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=
@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