2

Hello everyone. I have a little problem : I am working with openmdao and pyOptSparseDriver. It is working for some solvers (SLSQP, PSQP for instance) so there is no problem about that installation.

Now i'd like to try the same with IPOPT, but the code is not given with pyoptsparse. I followed the COIN-OR documentation to install IPOPT (http://www.coin-or.org/Ipopt/documentation/node10.html), and everything SEEMS ok (i don't know how to check it). Now i have a COIN-OR folder on my desk and i don't know how to make pyoptsparse take IPOPT from it (it is the line "from . import pyoptcore" that crashes), from pyIPOPT/pyIPOPT.py. Can anyone help me ? Thank you by advance

gael17
  • 67
  • 11

2 Answers2

1

we're using IPOPT with OpenMDAO through the pytoptsparse package, and installed it as a standalone library, like you've done. To get that to work you need to set the IPOPT_DIR environment variable pointing to the location you installed IPOPT before running the install of pyoptsparse.

So assuming you installed IPOPT in e.g. /usr/local/IPOPT:

$ export IPOPT_DIR=/usr/local/IPOPT
$ cd /path/to/pyoptsparse/
$ python setup.py install

this should result in pyoptsparse compiling the python wrapper for IPOPT and produce the file pyoptcore.so that will be placed in Python's site-packages/pyoptsparse/pyIPOPT.

On our cluster we had to modify the pyoptsparse/pyIPOPT/setup.py file slightly since we compiled everything with Intel, but if you compile with gfortran the official version of pyoptsparse should work for you.

Alternatively, you can do like Justin suggests, which is essentially the instructions you find in the pyoptsparse docs.

frza
  • 56
  • 4
  • The command python setup.py install seems to have no effect. When in the shell, the command os.getenv('IPOPT_DIR') gives the good path (export worked). Looking at pyIPOPT/setup.py, i wonder if the function configuration (returning the config) is called ... – gael17 Aug 03 '16 at 09:57
  • you may need to remove the build directory first to do a clean install of pyoptsparse. for debugging you can also try to comment out all other optimisers in pyoptsparse/setup.py (https://bitbucket.org/mdolab/pyoptsparse/src/64bf91c487894c531941a99eb1aeb4880ae0e3a3/pyoptsparse/setup.py?at=default&fileviewer=file-view-default). you can try to add some print statements in pyoptsparse/pyIPOPT/setup.py file to see if its called and detects your IPOPT installation correctly. – frza Aug 03 '16 at 10:53
  • Okay, so i started all over from downloading a new mdolab-pyoptsparse*.zip I go this error after a gcc call: /usr/bin/ld: cannot find -lcoinhsl Isn't HSL optional ? I dowloaded MUMPS and the doc seems to explain that it is enough for solving the linear systems... – gael17 Aug 03 '16 at 14:41
  • the pyoptsparse pyIPOPT setup.py file requires that lib to be there (https://bitbucket.org/mdolab/pyoptsparse/src/64bf91c487894c531941a99eb1aeb4880ae0e3a3/pyoptsparse/pyIPOPT/setup.py?at=default&fileviewer=file-view-default#setup.py-48). Did you otherwise follow the IPOPT installation instructions in the pyoptsparse docs? They remommend configuring with `$ ./configure --disable-linear-solver-loader`. you can build that from the docs directory with `make html`. – frza Aug 03 '16 at 14:52
  • I was not following the doc but as i was looking over the files setup.py i was doing about the same. I started all over for pyoptsparse and IPOPT. What is the command --disable-linear-solver-loader supposed to do ? I expected "Copy ma27ad.f from the pyOptSparse bitbucket page into the Ipopt/ThirdParty/HSLold/ directory" to replace HSL. I guess i'll have to examine all these license-getting things to get HSL ? – gael17 Aug 04 '16 at 08:14
  • I can see that we built IPOPT with the HSL lib, but I guess you can try to remove `coinhsl` from the pyIPOPT/setup.py, and use the MUMPS linear solver instead. My guess is that you can simply replace `coinhsl` with `coinmumps`. MUMPS is as far as I can see free for commercial use. – frza Aug 04 '16 at 08:55
0

you have to put the ipopt source code into the src folder of pyopt-sparse and then recompile the package.

Justin Gray
  • 5,605
  • 1
  • 11
  • 16
  • What do you mean by source code ? There are 6 different folders in Ipopt/src. Putting them in pyIPOPT/src did not work – gael17 Aug 02 '16 at 15:30