0

I am trying to install the IPOPT algorithm using the pyOptSparse package. I got the SNOPT and SLSQP algorithms working. For the IPOPT algorithm, the build is successful, however when using the algorithm i get the error:

 pyOptSparse Error: There was an error importing the compiled IPOPT module

I am building the project in a Ubuntu based Docker container, and have followed the documentation(doc/optimizers/pyipopt.rst) on IPOPT in pyOptSparse pretty much exactly. The complete dockerfile is available( I have included my attempts using both the apt-based package, and some copying of the source per this suggestion). The most relevant part is:

RUN wget http://www.coin-or.org/download/source/Ipopt/Ipopt-3.11.7.tgz && \
    gunzip Ipopt-3.11.7.tgz && \
    tar -xvf Ipopt-3.11.7.tar && \
    rm -rf Ipopt-3.11.7.tar && \
    mv Ipopt-3.11.7 /pyoptsparse/pyoptsparse/pyIPOPT/Ipopt && \
    wget -P /pyoptsparse/pyoptsparse/pyIPOPT/Ipopt/ThirdParty/HSLold/ \
        https://bitbucket.org/mdolab/pyoptsparse/downloads/ma27ad.f && \
    cd /pyoptsparse/pyoptsparse/pyIPOPT/Ipopt/ThirdParty/Blas/ && \
    ./get.Blas && \
    cd /pyoptsparse/pyoptsparse/pyIPOPT/Ipopt/ThirdParty/Lapack/ && \
    ./get.Lapack && \
    cd /pyoptsparse/pyoptsparse/pyIPOPT/Ipopt && \
    ./configure --disable-linear-solver-loader && \
    make install

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pyoptsparse/pyoptsparse/pyIPOPT/Ipopt/lib
RUN cd pyoptsparse && \
    python setup.py build_ext --inplace

In the output of the build, pyOptSparse picks up IPOPT "building 'pyoptsparse.pyIPOPT.pyipoptcore' extension".

Does anyone have any suggestions on how I might get the IPOPT algorithm installed, or how I might debug the installation?

Thanks!

Additional notes:

  • I did not get the SLSQP algorithm latest commit of pyOptSparse to work, thus I am using the commit fd33788 from late last year.
  • I have tried various combinations of the --prefix=/usr/local, but if any one have any specific suggestions on the location and environment variables, I am all ears
Community
  • 1
  • 1
user1380
  • 316
  • 2
  • 4

1 Answers1

0

Cause

pyIPOPT, in pyOptSparse, does not currently support Python3. Specifically it uses calls to Py_FindMethod and a number conversion call in /pyoptsparse/pyoptsparse/pyIPOPT/src/.

Solution

The original pyIPOPT code has been updated with Python3 support and can be used:

RUN git clone https://github.com/xuy/pyipopt.git && \
    mv /pyipopt/src/pyipoptcoremodule.c /pyoptsparse/pyoptsparse/pyIPOPT/src/pyipoptcoremodule.c && \
    mv /pyipopt/src/hook.h /pyoptsparse/pyoptsparse/pyIPOPT/src/hook.h && \
    mv /pyipopt/src/callback.c /pyoptsparse/pyoptsparse/pyIPOPT/src/callback.c

At this point IPOPT runs, but exits without calling the objective. This is because of an status code -12, indicating invalid options. Editing the default options to def_opts = {} solves this, and the algorithm is able to converge the OpenMDAO Paraboloid example.

Further Work

  • Update the pyOptSparse version of pyIPOPT with the updated version of pyIPOPT
  • Possibly figure out why the default parameters in the pyOptSparse version of pyIPOPT does not work. Convert the defaults to something that works
Community
  • 1
  • 1
user1380
  • 316
  • 2
  • 4