Casadi does not find nlp solver dll/so/dylib (again)

305 views
Skip to first unread message

Gregor Reich

unread,
Jan 18, 2019, 10:58:30 AM1/18/19
to CasADi
Hi all

I try to run Casadi together with a nlp solver - this time on windows; again, I run into the problem that Casadi does not find the module "knitro" (whereas the knitromatlab interface works nicely). I think the usual workaround I've seen is to copy the dll of a solver into the same directly as libcasadi_npsol_knitro; this was recently suggested for WORHP on windows, and I've done the same thing for knitro on Mac. So this seems to be a very general problem with casadi.

Is there a better solution for this? I'm currently on a cluster that does not give me direct access to the dlls.

Thank you and best regards, Gregor.

Gregor Reich

unread,
Feb 19, 2019, 6:48:40 AM2/19/19
to CasADi
Hi all

My attempts to install casadi with NLP solver KNITRO on a windows machine to which I do not have administrator privileges are progressing... I could get my hands on the DLL files for KNITRO and copy them into the same directory where libcasadi_npsol_knitro.dll resides. However, I still get the same error that the KNITRO DLL cannot be found:

CasADi -  MESSAGE("nlp::init") [.../casadi/core/function_internal.cpp:302]
CasADi -  MESSAGE("nlp::init") [.../casadi/core/x_function.hpp:232]
CasADi -  MESSAGE("nlp::init") [.../casadi/core/sx_function.cpp:200]
CasADi -  MESSAGE("Using live variables: work array is 230 instead of 27503") [.../casadi/core/sx_function.cpp:397]
CasADi -  MESSAGE("27503 elementary operations") [.../casadi/core/sx_function.cpp:462]
CasADi -  WARNING(".../casadi/core/plugin_interface.hpp:292: Assertion "handle!=nullptr" failed:
PluginInterface::load_plugin: Cannot load shared library 'libcasadi_nlpsol_knitro.dll':
   (
    Searched directories: 1. casadipath from GlobalOptions
                          2. CASADIPATH env var
                          3. PATH env var (Windows)
                          4. LD_LIBRARY_PATH env var (Linux)
                          5. DYLD_LIBRARY_PATH env var (osx)
    A library may be 'not found' even if the file exists:
          * library is not compatible (different compiler/bitness)
          * the dependencies are not found
   )
  Tried 'M:\Matlab\casadi-windows-matlabR2014b-v3.4.4' :
    Error code (WIN32): 126
  Tried '' :
    Error code (WIN32): 126
  Tried '.' :
    Error code (WIN32): 126"
) [.../casadi/core/plugin_interface.hpp:148]
Error using casadi.nlpsol (line 863)
.../casadi/core/plugin_interface.hpp:387: Plugin 'knitro' is not found.


Error in solve_by_poly_matrices (line 132)
S
= nlpsol('S', 'knitro', nlp, opts_cas);

As you can see, casadi and in particular libcasadi_nlpsol_knitro.dll is found. However, KNITRO is not loaded because something is wrong (although the DLL are in the same directory, namely M:\Matlab\casadi-windows-matlabR2014b-v3.4.4). Maybe there is a particular version requested, or some other dependency that is not explicit in the error message? (Unfortunately, I cannot run Microsofts Process Monitor to check for any other file access attempt, because I have no Admin privileges...).

Thank you very much and best, Gregor.

Gregor Reich

unread,
Feb 19, 2019, 7:19:18 AM2/19/19
to CasADi
Hi, me again.

I found out what the problem was (by opening libcasadi_nlpsol_knitro.dll in a text editor...): Casadi is querying for a particular version of KNITRO, namely 10.3.2. This is a little awkward, as the most recent version (11.0.1) works fine, if one changes the file name accordingly. This might be something to fix, or, if not, at least something to document.

Best regards, Gregor.

Eka Suwartadi

unread,
Feb 19, 2019, 3:41:57 PM2/19/19
to CasADi
Thank you Gregor !

By changing the knitro***.dll filename to knitro1032.dll, I am able to call KNITRO solver. 

Hanene Yacoubi

unread,
Oct 12, 2019, 11:23:33 PM10/12/19
to CasADi
Hi,
I have the same Error: Plugin 'knitro' is not found" casadi . I changed the name of the file knitro.dll to knitro1032.dll and does not work (knitro and casadi 3.4.4).
thanks for help

Bruno M

unread,
Dec 22, 2019, 4:34:07 AM12/22/19
to CasADi
Hi Gregor,

I have the same problem. I tried to open the dll with the text editor but it's unreadable due to the encoding... What did you use to open it?

Bruno M

unread,
Dec 24, 2019, 2:59:32 AM12/24/19
to CasADi
Hi, at the end I solved by renaming the knitro1211.dll to knitro1032.dll
Reply all
Reply to author
Forward
0 new messages