简体   繁体   中英

Building graph-tool on OSX with Python 3.4

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?

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.

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....

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM