使用Anaconda在OSX上安装GalSim时出现问题 [英] Trouble Installing GalSim on OSX with Anaconda

查看:100
本文介绍了使用Anaconda在OSX上安装GalSim时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have been attempting to install GalSim on OSX 10.9 Mavericks with Anaconda installed and set as the default python, but have been running into the following error:

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:的实例,即使我按照GalSim FAQ中的建议确保使用的编译器为clang++.

When checking my config.log files, there are a few instances of Undefined symbols for architecture x86_64:, even though I made sure that the compiler being used was clang++, as recommended in the 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文件来确认它.我已经使用了命令

I'm not sure what to do to remedy the situation. I've reinstalled Boost several times, using the ./b2 -a command for each time after the first. I've made sure that boost is referencing /anaconda/bin/python, and confirmed it by checking the project-config.jam files for each installation. I've used the commands

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

如GalSim常见问题解答中的建议.我真的不知道除了尝试重新安装所有必需的软件包之外,还可以尝试其他什么方法.在我去不得已之前,有人对做什么有任何建议吗?感谢您的帮助.

as recommended in the GalSim FAQ. I am really not sure what else to try besides attempting to reinstall all the requisite packages all over again. Does anyone have any advice on what to do before I go to my last resort? Any help is appreciated.

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

Below is the output from my last scons run:

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

推荐答案

我相信问题的症结在于anaconda的python库没有正确设置安装名称.这是otool在我的系统上为该库报告的内容:

I believe the crux of the problem is that anaconda's python library doesn't have the install name set correctly. Here is what otool reports for that library on my system:

$ 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针对它进行编译时,该库仅具有没有目录的文件名.因此,加载程序不知道它在哪里,而是去寻找正常位置,然后首先找到系统版本.

On Macs (as opposed to other Unix/Linux varieties), the runtime loader looks at the install names of all the libraries to be loaded in the dylib or executable. Since anaconda doesn't have this set correctly here, when GalSim or boost compile against it, that library just has the file name with no directory. So the loader doesn't know where it is, goes looking in the normal places, and finds the system version first.

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

The answer pointed to by user2932864 basically changes the runtime search order to put the anaconda location before the system python, so the loader finds the anaconda version. However, this solution doesn't work so well if you want to have both python options available on your system. The better solution (IMO) is to fix the anaconda library file. To do this, simply type (assuming your anaconda installation is in /anaconda):

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

完成此操作后,我可以成功地通过以下方式安装Boost(1.53)

After doing this, I was able to successfully install boost (1.53) with

./bootstrap.sh --prefix=$HOME/anaconda_install/ --with-python=/anaconda/bin/python2.7
./b2 link=shared 
./b2 link=shared install

但是升压有同样的问题.他们也没有正确设置libboost_python.dylib的安装名称.如果这是系统上唯一的增强安装,那么您可能还可以.但是由于我有很多不同的版本,所以我不得不这样做

But then boost has the same problem. They don't properly set the install name of libboost_python.dylib either. If this is the only boost installation on your system, then you are probably ok. But since I have quite a few different versions on mine, I then had to do

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

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

Then I was able to install GalSim the normal way using the anaconda python:

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

这篇关于使用Anaconda在OSX上安装GalSim时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆