5

I tried to install graph-tool on Mac OSX 10.10 using homebrew. The brew build process works fine, but when I try to import graph-tool I get the error described in this question. Another problem with homebrew is that I always builds graph-tool for python2.7 and it installs the packages in the Python 2.7 sit-packages folder. But I want to use it with Python 3.4. These are the reasons why I tried to build graph-tool from source.

The ./configure command automatically uses Python 2.7, too. So I passed it the desired Python version with ./configure PYTHON=python3.4

It then detects the correct version as well as the related paths but crash with the following error:

configure: error:
Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, via the LDFLAGS environment variable.
Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"

====================================================================== ERROR! You probably have to install the development version of the Python package for your distribution. The exact name of this package varies among them.

======================================================================

The error occurs with and without PYTHON variable set. From the output of ./configure I can see that everything works fine except for the last line, which says:

checking consistency of all components of python development environment... no

Whats does the above line mean and how do I properly install graph-tool on my maschine?

Community
  • 1
  • 1
MaxPowers
  • 5,235
  • 2
  • 44
  • 69

3 Answers3

2

The error message is explaining exactly what needs to be done. Since python was installed in a non-standard path, you need to pass the flag LDFLAGS="-L/usr/non-standard-path/python/lib" pointing to the directory where the python libraries are located. This is most likely "/usr/local/lib", if you are using homebrew.

Tiago Peixoto
  • 5,149
  • 2
  • 28
  • 28
  • I tried to set the LDFLAGS before posting this question, but unfortunately it had no effect. – MaxPowers Jul 21 '15 at 11:14
  • Then you probably did not pass the correct path. Look inside the config.log file to see the actual error. – Tiago Peixoto Jul 21 '15 at 11:44
  • Did not help me either. It would seem option `-u _PyMac_Error Python.framework/Versions/2.7/Python` to gcc is what is causing it to choke but have no idea how to fix this – Andres Kütt Jul 17 '16 at 08:27
  • One year has passed and I still keep getting the same error message, which tells me to pass the "non-standard" Python libs directory, even though I passed the *exact* location. – MaxPowers Jan 09 '17 at 16:10
  • This does not work. One possible source of error is that configure's `checking for python3.4` results in `/Users/username/.virtualenvs/graph-tool/bin/python`, while `checking for Python include path` results in `-I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m`. The same for the `lib`. This likely creates consistency problems. – Jorge Leitao Jan 21 '17 at 07:57
  • @MaxPowers any luck with that? I am having the same problem. – Duccio A Dec 14 '17 at 08:24
  • Unfortunately not. I've just checked it once again on another machine and with Python3.6. configure automatically take Python2.7. When passing `PYTHON="python3"` it *correctly* detects all paths for Python3 but then throws the same old error message. Passing `LIBS="-L/path/to/python"` results in the same error. – MaxPowers Dec 15 '17 at 12:12
  • I also updated `autoconf`, `automake`, and `pkg-config` as suggested by @ostrokach. Did not help. I could the exclude the behaviour @L.C.Leitão mentioned. Configure detects all path correctly. – MaxPowers Dec 15 '17 at 12:18
  • It is very hard to troubleshoot this without proper debug information, such as the *full* output of configure, config.log, etc. The snippets you provided do not contain useful information. – Tiago Peixoto Dec 15 '17 at 16:22
  • @MaxPowers I found that I had to pass the variable PYTHON_EXTRA_LDFLAGS, as I explain in detail in the answer. – Duccio A Dec 18 '17 at 21:12
0

I was getting this error when I was trying to install graph-tool using outdated an autoconf / automake / pkg-config combination (installed using yum in CentOS 5.10). Installing those packages from source fixed the problem... although I'm not sure how this related to my python installation....

ostrokach
  • 17,993
  • 11
  • 78
  • 90
0

It worked for me by passing the variable PYTHON_EXTRA_LDFLAGS="-Wl,-stack_size,1000000 -F/usr/local/Cellar/python3/3.6.3/Frameworks -framework CoreFoundation".
In your case, it would be the path to the homebrew installation of python3.4.
The way I found out is that in the config.log, the error message shows the following:

configure:19023: checking python extra libraries
configure:19030: result: -ldl  -framework CoreFoundation 
configure:19037: checking python extra linking flags
configure:19044: result: -Wl,-stack_size,1000000  -framework CoreFoundation Python.framework/Versions/3.6/Python
configure:19051: checking consistency of all components of python development environment
configure:19079: gcc -o conftest -g -O2 -DNDEBUG  -I/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/include/python3.6m -F/usr/local/Cellar/python3/3.6.3/Frameworks/ -Wl,-stack_size,1000000  -framework CoreFoundation Python.framework/Versions/3.6/Python conftest.c  -L/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib -lpython3.6m -ldl  -framework CoreFoundation  -ldl  -framework CoreFoundation  >&5
clang: error: no such file or directory: 'Python.framework/Versions/3.6/Python'

The error seems to be path 'Python.framework/Versions/3.6/Python', that in a homebrew installation does not exist. I search for the same path in the config.log and I found this line:

PYTHON_EXTRA_LDFLAGS="-Wl,-stack_size,1000000 -framework CoreFoundation Python.framework/Versions/3.6/Python"

So, the solution for me was to pass this variable with the right path.

Duccio A
  • 1,402
  • 13
  • 27