I should also mention that I compiled casadi from source and therefore commented the corresponding line in /acados/interfaces/acados_template/setup.py.
However, when I try to run acados/examples/acados_python/getting_started/ocp/minimal_example_ocp.py, I get the following error:
Traceback (most recent call last):
File "/Users/tudoroancea/acados/examples/acados_python/getting_started/ocp/minimal_example_ocp.py", line 102, in <module>
ocp_solver = AcadosOcpSolver(ocp, json_file = 'acados_ocp.json')
File "/Users/tudoroancea/acados/interfaces/acados_template/acados_template/acados_ocp_solver.py", line 953, in __init__
self.__acados_lib = CDLL(libacados_filepath)
File "/Users/tudoroancea/.pyenv/versions/3.9.13/lib/python3.9/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/tudoroancea/acados/lib/libacados.dylib, 0x0006): Library not loaded: 'libqpOASES_e.3.1.dylib'
Referenced from: '/Users/tudoroancea/acados/lib/libacados.dylib'
Reason: tried: 'libqpOASES_e.3.1.dylib' (no such file), '/usr/local/lib/libqpOASES_e.3.1.dylib' (no such file), '/usr/lib/libqpOASES_e.3.1.dylib' (no such file), '/Users/tudoroancea/acados/examples/acados_python/getting_started/ocp/libqpOASES_e.3.1.dylib' (no such file), '/usr/local/lib/libqpOASES_e.3.1.dylib' (no such file), '/usr/lib/libqpOASES_e.3.1.dylib' (no such file)
It is weird because I set ACADOS_SOURCE_DIR to the correct installation dir (in my case /Users/tudoroancea/acados) and also appended /Users/tudoroancea/acados/lib to my LD_LIBRARY_PATH variables, and yet this dir doesnât seem to be explored.
I also tried to create symlinks for all the dynamic libraries located in this dir in /usr/local/lib but I got the same error message.
Hi Jonathan, I just encounter the same problem as Tudor and fixed it after seeing your answer here. I believe updating the Documentation here would be really helpful! Maybe just add a line in comment telling people it should be DYLD_LIBRARY_PATH on MacOS. Could help new users save time
the path in your error message acados/examples/acados_python/getting_started/libqpOASES_e.dylib looks weird. Please make sure that DYLD_LIBRARY_PATH contains the path to <acados root directory>/lib and check that <acados root directory>/lib indeed contains a file named qpOASES_e.dylib (if it doesnât recompile acados with the flag -DACADOS_WITH_QPOASES=ON)
I checked the env variables with echo and they point to the right folders and the .dylib file is there.
Please see below the detailed error message when I run the minimal ocp example in the getting started folder for python interface.
Many thanks!
Traceback (most recent call last):
File â/Users/user_macbook/acados/examples/acados_python/getting_started/minimal_example_ocp.pyâ, line 109, in
main()
File â/Users/user_macbook/acados/examples/acados_python/getting_started/minimal_example_ocp.pyâ, line 88, in main
ocp_solver = AcadosOcpSolver(ocp)
File â/Users/user_macbook/acados/interfaces/acados_template/acados_template/acados_ocp_solver.pyâ, line 239, in init
self.__acados_lib = get_shared_lib(libacados_filepath, self.winmode)
File â/Users/user_macbook/acados/interfaces/acados_template/acados_template/utils.pyâ, line 130, in get_shared_lib
shared_lib = DllLoader(shared_lib_name)
File â/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/ctypes/init.pyâ, line 366, in init
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/user_macbook/acados/lib/âŚ/lib/libacados.dylib, 0x0006): Library not loaded: libqpOASES_e.dylib
Referenced from: <751133E9-561C-39BD-990B-42D2499B749F> /Users/user_macbook/acados/lib/libacados.dylib
Reason: tried: âlibqpOASES_e.dylibâ (no such file), â/System/Volumes/Preboot/Cryptexes/OSlibqpOASES_e.dylibâ (no such file), âlibqpOASES_e.dylibâ (no such file), â/Users/user_macbook/acados/examples/acados_python/getting_started/libqpOASES_e.dylibâ (no such file), â/System/Volumes/Preboot/Cryptexes/OS/Users/user_macbook/acados/examples/acados_python/getting_started/libqpOASES_e.dylibâ (no such file), â/Users/user_macbook/acados/examples/acados_python/getting_started/libqpOASES_e.dylibâ (no such file)