[PYTHON] How to install OpenGM on OSX with macports

Preparation

Package installation


sudo port install python27 py27-scipy py27-numpy py27-networkx py27-h5py py27-matplotlib py27-nose nosetests_select
sudo port install boost +python27
sudo port install doxygen graphviz py27-pygraphviz

Clone with git


git clone https://github.com/opengm/opengm.git
cd opengm/
mkdir build
cd build
cmake ..

Build

Add external library


make -k externalLibs

I don't cry even if I get an error and stop. .. .. Only the external library that can be compiled is added to ../CMakeFile.

--In the following, AD3, TRWS, MRF, QPBO, MAXFLOW, PLANARITY, BLOSSOM5 are added as external libraries. --In addition, boost and hdf5 are used. --Create a python binding (PLANARITY, BLOSSOM5 must be added (2015/11/27)).

diff:../Modification of CMakeFile (example). Addition of external library, Boost, etc.


diff --git a/CMakeLists.txt b/CMakeLists.txt
index d5fb1a9..d58c167 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,30 +67,30 @@ endif()
 OPTION(BUILD_EXAMPLES "Build Examples" ON)
 OPTION(BUILD_TUTORIALS "Build Tutorials" ON)
 OPTION(BUILD_COMMANDLINE "Build Commandline" OFF)
-OPTION(WITH_AD3 "Include AD3" OFF)
+OPTION(WITH_AD3 "Include AD3" ON)
 OPTION(WITH_CPLEX "Include CPLEX" OFF)
 OPTION(WITH_GUROBI "Include GUROBI" OFF)
-OPTION(WITH_BOOST "Include BOOST" OFF)
-OPTION(WITH_HDF5 "Include HDF5" OFF)
-OPTION(WITH_TRWS "Include wrapper for TRWS code" OFF)
+OPTION(WITH_BOOST "Include BOOST" ON)
+OPTION(WITH_HDF5 "Include HDF5" ON)
+OPTION(WITH_TRWS "Include wrapper for TRWS code" ON)
 OPTION(WITH_GCO "Include wrapper for GCO code" OFF)
-OPTION(WITH_MRF "Include wrapper for MRF code" OFF)
-OPTION(WITH_QPBO "Include wrapper for QPBO code" OFF)
+OPTION(WITH_MRF "Include wrapper for MRF code" ON)
+OPTION(WITH_QPBO "Include wrapper for QPBO code" ON)
 OPTION(WITH_FASTPD "Include wrapper for FastPD code" OFF)
-OPTION(WITH_MAXFLOW "Include wrapper for MAXFLOW code" OFF)
+OPTION(WITH_MAXFLOW "Include wrapper for MAXFLOW code" ON)
 OPTION(WITH_MAXFLOW_IBFS "Include wrapper for MAXFLOW-IBFScode" OFF)
 OPTION(WITH_LIBDAI "Include wrapper for LIBDAI code" OFF)
 OPTION(WITH_DAOOPT "Include wrapper for DAOOPT code" OFF)
 OPTION(WITH_MPLP "Include wrapper for MPLP code" OFF)
 OPTION(WITH_SRMP "Include wrapper for SRMP code" OFF)
-OPTION(WITH_PLANARITY "Include wrapper for PLANARITY code" OFF)
-OPTION(WITH_BLOSSOM5 "Include wrapper for BLOSSOM5 code" OFF)
+OPTION(WITH_PLANARITY "Include wrapper for PLANARITY code" ON)
+OPTION(WITH_BLOSSOM5 "Include wrapper for BLOSSOM5 code" ON)
 OPTION(WITH_OPENMP "Include OpenMP" OFF)
 OPTION(WITH_VIGRA "Include VIGRA" OFF)
 OPTION(WITH_CONICBUNDLE "Include ConicBundleLibrary" OFF)
 OPTION(WITH_MATLAB "Activate MatLab-Code" OFF)
 OPTION(BUILD_CONVERTER "Build several converters" OFF)
-OPTION(BUILD_PYTHON_WRAPPER "Build python wrapper" OFF)
+OPTION(BUILD_PYTHON_WRAPPER "Build python wrapper" ON)
 OPTION(BUILD_MATLAB_WRAPPER "Build matlab wrapper" OFF)
 ###Grante needs C++11. Since we have not tested OpenGM under this standard yet, using Grante is realy experimental!!!
 ###OPTION(WITH_GRANTE "Include wrapper for grante" OFF)

Below, set the cmake option so that you don't go to the system / usr / bin / python (using macports python2.7).

CMake again


rm CMakeCache.txt
cmake ..  \
  -DPYTHON_EXECUTABLE:FILEPATH=/opt/local/bin/python2.7 \
  -DPYTHON_INCLUDE_DIR:PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Headers/ \
  -DPYTHON_LIBRARY:FILEPATH=/opt/local/lib/libpython2.7.dylib 

And build


make -j 4

Document creation


make doc

test

And test


make test

Running tests...
...
100% tests passed, 0 tests failed out of 60

Total Test time (real) =  45.89 sec

Test python binding


make test-python-wrapper

...
Ran 70 tests in 3.584s

OK
[100%] Built target test-python-wrapper

If make test-python-wrapper says there is no nosetests

nosetests to nosetests-2.Link to 7


sudo port select --set nosetests nosetests27

Installation

If you install locally


make DESTDIR=$HOME/local install

mkdir $HOME/local/usr/local/lib
cp ../build/src/external/libexternal-library-* $HOME/local/usr/local/lib

with this

--Header files under $ HOME / local / usr / local / include / opengm / --There is a library for external libraries under $ HOME / local / usr / local / lib / --The library for python is under $ HOME / local / usr / local / lib / python2.7 / site-packages / It will be installed.

By the way, if you don't use an external library or python, OpenGM is only a header file.

Settings: use python binding

~/.bash_Add to profile


# opengm                                                                                                                                       
export LD_LIBRARY_PATH=$HOME/local/usr/local/lib/:$LD_LIBRARY_PATH
export PYTHONPATH=$HOME/local/usr/local/lib/python2.7/site-packages/:$PYTHONPATH

After this

macports python2.Run 7


$ python2.7
Python 2.7.10 (default, Oct 18 2015, 09:28:19) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import opengm
>>> 

Recommended Posts

How to install OpenGM on OSX with macports
How to install caffe on OS X with macports
How to install mysql-connector-python on mac
How to install python-pip with ubuntu20.04LTS
How to install graph-tool on macOS
How to install VMware-Tools on Linux
How to install pycrypto on Windows
How to install OpenCV on Mac
How to install PyPy on CentOS
How to install TensorFlow on CentOS 7
Install pyStruct on MacOSX10.11 with macports
How to install mysql-connector with pip3
How to install Maven on CentOS
How to install Go on Ubuntu
How to install music 21 on windows
How to install Anaconda with pyenv
How to install Python2.7 python3.5 with pyenv (on RHEL5 CentOS5) (2016 Nov)
How to install Theano on Mac OS X with homebrew
How to install aws-session-manager-plugin on Manajro Linux
How to install drobertadams / toggl-cli on Mac
How to install DLIB with 2020 / CUDA enabled
How to install Anisble on Amazon Linux 2
How to install richzhang / colorization on Windows 10
How to install Apache (httpd) on CentOS7
How to install php7.4 on Linux (Ubuntu)
How to install Eclipse GlassFish 5.1.0 on CentOS 7
How to install Apache (httpd) on CentOS8
How to run Cython on OSX Memo
How to install zsh (with .zshrc customization)
How to install NumPy on Raspberry Pi
How to install cx_Oracle on macOS Sierra
How to install python3 with docker centos
How to install pandas on EC2 (How to deal with MemoryError and PermissionError)
[2020 version] How to install Python3 on AWS EC2
How to install Python
Strategy on how to monetize with Python Java
How to install OpenCV on Jetson Nano Python
How to install python
How to quickly install h5py on Windows 10 [Unofficial]
Install aws-cli on MacPorts
How to install Nbextensions
How to install Camunda Modeler on Manjaro Linux
[Python] How to install OpenCV on Anaconda [Windows]
Install pyenv on OSX
How to install Prover9
How to install / verify graphviz on anaconda / windows10
How to install Linux on a 32bit UEFI PC
How to install Git GUI and Gitk on CentOS
Autoencoder with Chainer (Notes on how to use + trainer)
How to infer MAP estimate of HMM with OpenGM
[AWS EC2] How to install Maven on Amazon Linux 2
How to install git on Linux such as EC2
How to operate Firefox with selenium on Windows Memo
[2020.8 latest] How to install Python
How to install Python [Windows]
Tabpy 1.0 (2020-01 version) How to install
How to register on pypi
How to update with SQLAlchemy?
How to cast with Theano
How to install mkl numpy
How to Alter with SQLAlchemy?