gael17
gael17

Reputation: 77

Import Error with certain modules in pyoptsparse

Hello everyone,

I have installed Openmdao, pyOpt and pyoptsparse on my computer. As my program works with the Scipy optimizer, I tried it with a random optimizer of pyoptsparse (that was 'ALPSO'). It worked and I was happy. But it turns out it seems to be the only one working.

Every time I try to use another one (like 'SLSQP', which is the default optimizer !), i get this message "pyOptSparse Error : There was an error importing the compiled SLSQP module", inside a frame made of '-' and '+'.

Does anybody know what to do ? I am using Ubuntu if it changes something.

Upvotes: 0

Views: 878

Answers (2)

gael17
gael17

Reputation: 77

Thanks to swryan for the link, i found the answer.

One of the possible answer was to put libgfortran.so.3 in anaconda2/lib, but i already had it.

They were also saying the problem was solved when installing anaconda 4.0+ but i also had the latest version.

What worked for me was to run : conda update libgfortran --force

Doing it without the --force retrogrades the scipy, which seems to disable scipy.optimize.least_squares. If you did that, you can then run conda update scipy --force

Upvotes: 1

Bret Naylor
Bret Naylor

Reputation: 754

Did you get any errors when you ran 'python setup.py install' for pyoptsparse? I looked at the setup.py file for pyoptsparse and there are some instructions in there that you could try:

    print("\nTo install, run: python setup.py install --user\n\n"
          "To build, run: python setup.py build_ext --inplace\n\n"
          "For help on C-compiler options run: python setup.py build --help-compiler\n\n"
          "For help on Fortran-compiler options run: python setup.py build --help-fcompiler\n\n"
          "To specify a Fortran compiler to use run: python setup.py install --user --fcompiler=<fcompiler name>\n\n"
          "For further help run: python setup.py build --help"
      )

Upvotes: 0

Related Questions