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!

There is an effort to make the Python interface work natively on Windows.

1 Like

Thank you for the notify, FreyJo.

I want to use acados python interface on Windows.
Then, I tired to build and install acadon on Windows but I could’t find the example titled “minimal_example_ocp_cmake.py”.
What I have done are as follows:

  1. git clone
  2. build acados using cmake MSVC 2017
  3. install acados
  4. I could’t find the example “minimal_example_ocp.py”

Please let me know kindly what is wrong?

Best,
ryuhhh

The example is here: https://github.com/acados/acados/blob/master/examples/acados_python/pendulum_on_cart/ocp/minimal_example_ocp_cmake.py
Let me know if it works for you.