Tuesday, July 31, 2018

Installation of NLopt python module for Linux

Installation of NLopt python module for Linux

  1. Install SWIG (follow instructions: http://swig.org/svn.html)
    1. cd ~
    2. git clone https://github.com/swig/swig.git
    3. cd swig
    4. ./autogen.sh ( sudo apt-get install automake [if aclocal not found])
    5. ./configure --prefix=<absolute path to current dir> --without-pcre
    6. make
    7. sudo apt-get install bison -y && sudo apt-get install byacc -y [if yacc not found]
    8. make install
  2. export PATH=$PATH:~/swig
  3. Install NLopt: (follow instructions: https://github.com/stevengj/nlopt)

  1. git clone https://github.com/stevengj/nlopt.git
  2. cd nlopt
  3. mkdir build
  4. cd build
  5. cmake -DPYTHON_EXECUTABLE=/usr/bin/python3.6 ..
  6. make
  7. sudo make install

       Note: copy the nlopt.py and _nlopt.so files to the desired dist-packages