Acados on windows with python interface

Hi :wave:

I would like to use acados library on windows with python interface.
Python 3.7 has been installed and acados was built with mingw64, seems succesfully.
environment variables that are added are as below.

ACADOS_PATH = D:\libraries\acados
ACADOS_SOURCE_DIR = D:\libraries\acados
LD_LIBRARY_PATH = D:\libraries\acados\lib

However, when I run โ€œminimal_example_ocp.pyโ€, I encountered a OS error 126. I guess that the module could not find lib files that are needed.
acados.lib and other lib files are in โ€œD:\libraries\acados\libโ€.

Here is the output of the powershell when excuting minimal_example_ocp.py

PS D:\libraries\acados\examples\acados_python\getting_started> python .\minimal_example_ocp.py

WARNING: Gauss-Newton Hessian approximation with EXTERNAL cost type not possible!
got cost_type_0: EXTERNAL, hessian_approx: 'GAUSS_NEWTON.'
GAUSS_NEWTON hessian is only supported for cost_types [NON]LINEAR_LS.
If you continue, acados will proceed computing the exact hessian for the cost term.
Note: There is also the option to use the external cost module with a numerical hessian approximation (see `ext_cost_num_hess`).
OR the option to provide a symbolic custom hessian approximation (see `cost_expr_ext_cost_custom_hess`).


WARNING: Gauss-Newton Hessian approximation with EXTERNAL cost type not possible!
got cost_type: EXTERNAL, hessian_approx: 'GAUSS_NEWTON.'
GAUSS_NEWTON hessian is only supported for cost_types [NON]LINEAR_LS.
If you continue, acados will proceed computing the exact hessian for the cost term.
Note: There is also the option to use the external cost module with a numerical hessian approximation (see `ext_cost_num_hess`).
OR the option to provide a symbolic custom hessian approximation (see `cost_expr_ext_cost_custom_hess`).


WARNING: Gauss-Newton Hessian approximation with EXTERNAL cost type not possible!
got cost_type_e: EXTERNAL, hessian_approx: 'GAUSS_NEWTON.'
GAUSS_NEWTON hessian is only supported for cost_types [NON]LINEAR_LS.
If you continue, acados will proceed computing the exact hessian for the cost term.
Note: There is also the option to use the external cost module with a numerical hessian approximation (see `ext_cost_num_hess`).
OR the option to provide a symbolic custom hessian approximation (see `cost_expr_ext_cost_custom_hess`).

rm -f libacados_ocp_solver_pendulum_ode
process_begin: CreateProcess(NULL, rm -f libacados_ocp_solver_pendulum_ode, ...) failed.
make (e=2): ์ง€์ •๋œ ํŒŒ์ผ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.
make: *** [clean_ocp_shared_lib] ์˜ค๋ฅ˜ 2
cc -fPIC -std=c99   -O2 -ID:/libraries/acados/include -ID:/libraries/acados/include/acados -ID:/libraries/acados/include/blasfeo/include -ID:/libraries/acados/include/hpipm/include  -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun.c
process_begin: CreateProcess(NULL, cc -fPIC -std=c99 -O2 -ID:/libraries/acados/include -ID:/libraries/acados/include/acados -ID:/libraries/acados/include/blasfeo/include -ID:/libraries/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun.c, ...) failed.
make (e=2): ์ง€์ •๋œ ํŒŒ์ผ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.
make: *** [pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun.o] ์˜ค๋ฅ˜ 2
Traceback (most recent call last):
  File ".\minimal_example_ocp.py", line 107, in <module>
    main()
  File ".\minimal_example_ocp.py", line 86, in main
    ocp_solver = AcadosOcpSolver(ocp, json_file = 'acados_ocp.json')
  File "d:\libraries\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 948, in __init__
    self.__acados_lib = CDLL(libacados_filepath)
  File "C:\Users\7275244\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] ์ง€์ •๋œ ๋ชจ๋“ˆ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค
OSError: [WinError 126] ์ง€์ •๋œ ๋ชจ๋“ˆ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

This is error message which means that โ€œThe specified module could not be found.โ€

When I print โ€œlibacados_filepathโ€ it looks like

D:\libraries\acados\lib\acados

Am I doing wrong? or acados can not used on Windows with python interfaces?

Best,
ryuhhh

Hi,

the Python interface does not support native Windows for now.
It recommended to use it via WSL:
https://docs.acados.org/python_interface/index.html#windows-10-wsl-and-vscode

Cheers!