casadi / casadi

CasADi is a symbolic framework for numeric optimization implementing automatic differentiation in forward and reverse modes on sparse matrix-valued computational graphs. It supports self-contained C-code generation and interfaces state-of-the-art codes such as SUNDIALS, IPOPT etc. It can be used from C++, Python or Matlab/Octave.
http://casadi.org
GNU Lesser General Public License v3.0
1.68k stars 372 forks source link

HSL solvers with IPOPT, undefined symbol: metis_nodend_ #2844

Open danielasun opened 2 years ago

danielasun commented 2 years ago

Hi, I'm using Casadi installed with pip and trying to use the HSL solvers with IPOPT.

I followed the instructions at https://github.com/casadi/casadi/wiki/Obtaining-HSL and made sure to add my install location for the hsl shared library: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

However, during execution when trying to use nlpsol I am getting the following error:

Exception of type: OPTION_INVALID in file "../../../../Ipopt/src/Algorithm/IpAlgBuilder.cpp" at line 321:
 Exception message: Selected linear solver MA27 not available.
Tried to obtain MA27 from shared library "libhsl.so", but the following error occured:
/usr/local/lib/libhsl.so: undefined symbol: metis_nodend_

I saw a couple of other issues referencing this but it seemed most people's issues went away after using the compiler flags or renaming libcoinhsl.so to libhsl.so

Thanks in advance for any assistance you can provide troubleshooting this.

gmsanchez commented 2 years ago

@danielasun I faced the same issue some time ago and I couldn't figure out how to fix it.

As a workaround, I installed HSL using ThirdParty-HSL and got HSL solvers to work.

Hope it helps in the meantime.

danielasun commented 2 years ago

@gmsanchez Thank you so much! Using ThirdParty-HSL ended up working for me, I still had to do the manual symbolic linking to libhsl.so but otherwise pretty painless! Thanks again.

Devil-li-x commented 2 years ago

I downloaded ubantu 22.04 on the official website of ubantu and installed it in the virtual machine. Then I downloaded the anaconda 3 environment in the system and created the environment of Python 37 in the env folder. In the environment of Python 37, PIP install casadi. Then I completed the compilation of HSL and generated the include and Lib folders according to the operation of thirdparty. However, when I ran my code here, I still prompted that Ma57 was an invalid option,@gmsanchez,please help me.