Build acados python interface under windows

Hi :wave:

According to the method shown in Windows python interface by asparc · Pull Request #968 · acados/acados · GitHub, I am building the Python interface of acados for Windows so that it can be used under Windows. I put the entire file into my anconda virtual environment, compiled, downloaded and installed it, and then ran minimal_example_ocp_cmake.py. The following problem will appear, Do I need to change the cmakelist according to this process? What is the solution to this problem?((Showing part of the error message output))

acados.lib(ocp_qp_osqp.obj) : error LNK2019: Unresolved external symbol init_linsys_solver,functionosqp_init_data  referenced symbol [D:\anaconda3\envs\
pytorch2_0\acados\examples\acados_python\pendulum_on_cart\ocp\c_generated_code\build\acados_ocp_solver_pendulum.vcxproj
]
acados.lib(ocp_qp_osqp.obj) : error LNK2001: Unresolved external symbol LINSYS_SOLVER_NAME [D:\anaconda3\envs\pytorch2_0\acados\examples
\acados_python\pendulum_on_cart\ocp\c_generated_code\build\acados_ocp_solver_pendulum.vcxproj]
D:\anaconda3\envs\pytorch2_0\acados\examples\acados_python\pendulum_on_cart\ocp\c_generated_code\acados_ocp_solver_pend
ulum.dll : fatal error LNK1120: 36 Unresolved external symbol [D:\anaconda3\envs\pytorch2_0\acados\examples\acados_python\pendulum_on_c
art\ocp\c_generated_code\build\acados_ocp_solver_pendulum.vcxproj]
Execution failed: Build command "cmake --build "D:\anaconda3\envs\pytorch2_0\acados\examples\acados_python\pendulum_on_cart\ocp\c_generated_code\build" --config Release -j8" was terminated by signal 1

If you run minimal_example_ocp.py, the following error will occur. What is the reason?

Traceback (most recent call last):
  File "D:\anaconda3\envs\pytorch2_0\acados\examples\acados_python\getting_started\minimal_example_ocp.py", line 111, in <module>
    main()
  File "D:\anaconda3\envs\pytorch2_0\acados\examples\acados_python\getting_started\minimal_example_ocp.py", line 90, in main
    ocp_solver = AcadosOcpSolver(ocp)
  File "d:\anaconda3\envs\pytorch2_0\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 231, in __init__
    self.__acados_lib = get_shared_lib(libacados_filepath, self.winmode)
  File "d:\anaconda3\envs\pytorch2_0\acados\interfaces\acados_template\acados_template\utils.py", line 123, in get_shared_lib
    shared_lib = DllLoader(shared_lib_name, winmode=winmode)
  File "D:\anaconda3\envs\pytorch2_0\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'D:/anaconda3/envs/pytorch2_0/acados/lib\..\bin\acados.dll' (or one of its dependencies). Try using the full path with constructor syntax.


Thank you for your answer :handshake:

Hi,

and sorry for the late reply.
Native support on Windows especially with an anaconda environment is not well tested.
I think the best experience with Windows and Python is to use WSL.

However, regarding your error. It seems from your first error message, that already the compilation of the acados core library does not work somehow for you, which is a requirement for the Python examples to work.
Since there is an error connected to OSQP, could you try to compile without OSQP first?

Best,
Jonathan

Hi

Thank you very much for your patient answer. I found that I can use it in the anaconda virtual environment by configuring it according to the workflow of Workflow with Microsoft Visual C Compiler (MSVC) in the tutorial.

1 Like