Mac OS X El Capitan を使用しています。Anacondabrew install GLPK
経由でPythonをインストールしました。CVXOPT の GLPK バインディングが必要なので、 経由ではなく手動でインストールしていcondo install
ます。ここでインストーラーを入手しました: http://cvxopt.org/download/index.htmlインストーラー
を入手したら、このページの指示に従いました:
http://lecueguillaume.github.io/2016/02/27/cvxopt -glpk-basis-pursuit/
setup.py ファイルを変更します。いくつかの追加変更を加えました。最初に、環境変数をコメントアウトして、ファイルに入力した変数の代わりに環境変数が選択される可能性を排除しました。
#BUILD_GLPK = int(os.environ.get("CVXOPT_BUILD_GLPK",BUILD_GLPK))
#GLPK_LIB_DIR = os.environ.get("CVXOPT_GLPK_LIB_DIR",GLPK_LIB_DIR)
#GLPK_INC_DIR = os.environ.get("CVXOPT_GLPK_INC_DIR",GLPK_INC_DIR)
次に、これらの変数を設定します。
- glpk モジュールをインストールする場合は 1 に設定します。
BUILD_GLPK = 1
- ディレクトリを含む
libglpk
( の場合のみ使用BUILD_GLPK = 1
)。GLPK_LIB_DIR = '/usr/local/Cellar/glpk/4.57/lib'
- ディレクトリを含む
glpk.h
( の場合のみ使用BUILD_GLPK = 1
)。GLPK_INC_DIR = '/usr/local/Cellar/glpk/4.57/include'
私のbrewインストールでは、チュートリアルのものではなくgulp 4.57が提供されたので、上記のバージョン番号を変更しました。
最後に、実行されていることを確認するために、これを追加しました:
if BUILD_GLPK:
print "*** BUILDING GLPK ***"
はif BUILD_GLPK
すでにありました。印刷行を追加しました。
それから私は先に進んで走りましpython setup.py install
た
*** BUILDING GLPK ***
running install
running bdist_egg
running egg_info
writing cvxopt.egg-info/PKG-INFO
writing top-level names to cvxopt.egg-info/top_level.txt
writing dependency_links to cvxopt.egg-info/dependency_links.txt
reading manifest file 'cvxopt.egg-info/SOURCES.txt'
writing manifest file 'cvxopt.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-x86_64/egg
running install_lib
running build_py
running build_ext
sh: line 1: 91286 Segmentation fault: 11 'gcc' --version 2> /dev/null > '/tmp/tmp1Xzj0m'
creating build/bdist.macosx-10.6-x86_64/egg
creating build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/__init__.py -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/amd.so -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/base.so -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/blas.so -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/cholmod.so -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/coneprog.py -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/cvxprog.py -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/glpk.so -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/info.py -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/lapack.so -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/misc.py -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/misc_solvers.so -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/modeling.py -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/msk.py -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/printing.py -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/solvers.py -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
copying build/lib.macosx-10.6-x86_64-2.7/cvxopt/umfpack.so -> build/bdist.macosx-10.6-x86_64/egg/cvxopt
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/coneprog.py to coneprog.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/cvxprog.py to cvxprog.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/info.py to info.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/misc.py to misc.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/modeling.py to modeling.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/msk.py to msk.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/printing.py to printing.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/solvers.py to solvers.pyc
creating stub loader for cvxopt/glpk.so
creating stub loader for cvxopt/base.so
creating stub loader for cvxopt/blas.so
creating stub loader for cvxopt/lapack.so
creating stub loader for cvxopt/umfpack.so
creating stub loader for cvxopt/cholmod.so
creating stub loader for cvxopt/amd.so
creating stub loader for cvxopt/misc_solvers.so
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/glpk.py to glpk.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/base.py to base.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/blas.py to blas.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/lapack.py to lapack.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/umfpack.py to umfpack.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/cholmod.py to cholmod.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/amd.py to amd.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/cvxopt/misc_solvers.py to misc_solvers.pyc
creating build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying cvxopt.egg-info/PKG-INFO -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying cvxopt.egg-info/SOURCES.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying cvxopt.egg-info/dependency_links.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying cvxopt.egg-info/top_level.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
writing build/bdist.macosx-10.6-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating 'dist/cvxopt-1.1.8-py2.7-macosx-10.6-x86_64.egg' and adding 'build/bdist.macosx-10.6-x86_64/egg' to it
removing 'build/bdist.macosx-10.6-x86_64/egg' (and everything under it)
Processing cvxopt-1.1.8-py2.7-macosx-10.6-x86_64.egg
Copying cvxopt-1.1.8-py2.7-macosx-10.6-x86_64.egg to /Users/myUsername/anaconda/lib/python2.7/site-packages
Adding cvxopt 1.1.8 to easy-install.pth file
それでも、Pythonで実行すると:
/Users/myUsername/anaconda/lib/python2.7/site-packages/cvxopt-1.1.8-py2.7-macosx-10.6-x86_64.egg/cvxopt/coneprog.pyc in lp(c, G, h, A, b, solver, primalstart, dualstart, **kwargs)
2805 if solver == 'glpk':
2806 try: from cvxopt import glpk
-> 2807 except ImportError: raise ValueError("invalid option "\
2808 "(solver = 'glpk'): cvxopt.glpk is not installed")
2809 glpk.options = options.get('glpk',{})
ValueError: invalid option (solver = 'glpk'): cvxopt.glpk is not installed
いくつかの異なる方法でアンインストールと再インストールを試みました。これは最も有望に思えましたが、まだ運がありません。何かアドバイス?