使用Anaconda在OSX上安装GalSim时出现问题

时间:2014-05-20 23:29:09

标签: anaconda galsim

我一直试图在安装了Anaconda的OSX 10.9 Mavericks上安装GalSim并将其设置为默认python,但一直遇到以下错误:

Unable to build a python loadable module using the python executable:
/usr/bin/env python,
the library name libpython2.7.a,
and the libdir //anaconda/lib/python2.7/config.
If these are not the correct library names, you can tell scons the 
correct names to use with the flags EXTRA_LIB_PATH and/or EXTRA_LIBS.

检查我的config.log文件时,有一些Undefined symbols for architecture x86_64:实例,即使我确保使用的编译器是clang++,如GalSim FAQ中所建议的那样。

还有许多以下情况:

/usr/bin/env python < .sconf_temp/conftest_73 > .sconf_temp/conftest_73.out
Fatal Python error: PyThreadState_Get: no current thread
sh: line 1: 17019 Abort trap: 6           /usr/bin/env python < ".sconf_temp/conftest_73" > ".sconf_temp/conftest_73.out"

我不知道如何解决这个问题。我已经多次重新安装Boost,在第一次之后每次使用./b2 -a命令。我已确保boost引用/anaconda/bin/python,并通过检查每个安装的project-config.jam文件来确认它。我已经使用了命令

./bootstrap.sh
./b2 -a toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install

根据GalSim常见问题解答中的建议。除了尝试重新安装所有必需的软件包之外,我真的不确定还有什么可以尝试的。在我去最后的手段之前,有没有人对我该做什么有任何建议?任何帮助表示赞赏。

以下是我上次scons运行的输出:

scons: Reading SConscript files ...
SCons is version 2.3.1 using python version 2.7.6
Python is from //anaconda/include/python2.7
Using the following (non-default) scons options:
   CXX = clang++
These can be edited directly in the file gs_scons.conf.
Type scons -h for a full list of available options.
Using python =  /usr/bin/env python
Using default PYPREFIX =  //anaconda/lib/python2.7/site-packages
Using compiler: /usr/bin/clang++
compiler version: 5.1
Determined that a good number of jobs = 2
Checking for C++ header file fftw3.h... yes
Checking for correct FFTW linkage... yes
Checking for boost header files... yes
Checking for C++ header file TMV.h... yes
Using TMV_LINK file: /usr/local/share/tmv/tmv-link
     -ltmv -lblas
Mac version is 10.9.3
XCode version is 5.1.1
Checking for correct TMV linkage... (this may take a little while)
Checking for correct TMV linkage... yes
Checking if we can build against Python... 
Unable to build a python loadable module using the python executable:
/usr/bin/env python,
the library name libpython2.7.a,
and the libdir //anaconda/lib/python2.7/config.
If these are not the correct library names, you can tell scons the 
correct names to use with the flags EXTRA_LIB_PATH and/or EXTRA_LIBS.

Please fix the above error(s) and rerun scons.
Note: you may want to look through the file INSTALL.md for advice.
Also, if you are having trouble, please check the INSTALL FAQ at 
   https://github.com/GalSim-developers/GalSim/wiki/Installation%20FAQ

3 个答案:

答案 0 :(得分:3)

我认为问题的症结在于anaconda的python库没有正确设置安装名称。以下是我系统上该库的otool报告:

$ otool -L /anaconda/lib/libpython2.7.dylib 
/anaconda/lib/libpython2.7.dylib:
    libpython2.7.dylib (compatibility version 2.7.0, current version 2.7.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 476.0.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

在Mac上(与其他Unix / Linux版本相反),运行时加载程序会查看要在dylib或可执行文件中加载的所有库的安装名称。由于anaconda在这里没有正确设置,当GalSim或boost编译时,该库只有文件名而没有目录。因此,加载器不知道它在哪里,在正常位置查找,并首先找到系统版本。

user2932864指向的答案基本上改变了运行时搜索顺序,将anaconda位置放在系统python之前,因此加载程序找到了anaconda版本。但是,如果您希望在系统上同时提供两个python选项,则此解决方案无法正常工作。更好的解决方案(IMO)是修复anaconda库文件。要做到这一点,只需键入(假设你的anaconda安装在/ anaconda中):

sudo install_name_tool -id /anaconda/lib/libpython2.7.dylib /anaconda/lib/libpython2.7.dylib 

执行此操作后,我能够使用

成功安装boost(1.53)
./bootstrap.sh --prefix=$HOME/anaconda_install/ --with-python=/anaconda/bin/python2.7
./b2 link=shared 
./b2 link=shared install

然后助推有同样的问题。他们也没有正确设置libboost_python.dylib的安装名称。如果这是您系统上唯一的升级安装,那么您可能没问题。但由于我的版本不同,我不得不这样做

install_name_tool -id $HOME/anaconda_install/lib/libboost_python.dylib $HOME/anaconda_install/lib/libboost_python.dylib

然后我能够使用anaconda python以正常方式安装GalSim:

scons PYTHON=/anaconda/bin/python PREFIX=$HOME/anaconda_install BOOST_DIR=$HOME/anaconda_install
sudo scons install

答案 1 :(得分:1)

是的,我相信这与我们的基础RPATH / @ dynlib @ logic相关,我们正在进行改造:https://github.com/conda/conda-build/pull/111。 Linux支持目前正在实施,OS X和Windows在todo列表中。

答案 2 :(得分:0)

迈克尔 - 我认为您的问题可能与此问题有关: Boost.Python python linkage error

简而言之,似乎提升有时会声称与anaconda python相关联,但它确实会链接到系统python,尽管这一切。

该页面也有解决方案。它看起来有点笨拙,所以你可能想看看别人是否有想法。但如果没有,那么你可以试试吗?

相关问题