I configured acados for use with the Python interface on macOS. Also, when installing this Python interface, I used conda to create a Python environment.
I can successfully run the minimal_example_ocp.py example from Terminal. However, trying to run this example from Spyder gives the following error:
rm -f libacados_ocp_solver_pendulum_ode.dylib
rm -f acados_solver_pendulum_ode.o
cc -fPIC -std=c99 -O2 -I/Users/../acados/include -I/Users/../acados/include/acados -I/Users/../acados/include/blasfeo/include -I/Users/../acados/include/hpipm/include -c -o acados_solver_pendulum_ode.o acados_solver_pendulum_ode.c
cc -fPIC -std=c99 -O2 -I/Users/../acados/include -I/Users/../acados/include/acados -I/Users/../acados/include/blasfeo/include -I/Users/../acados/include/hpipm/include -c -o pendulum_ode_model/pendulum_ode_impl_dae_fun.o pendulum_ode_model/pendulum_ode_impl_dae_fun.c
cc -fPIC -std=c99 -O2 -I/Users/../acados/include -I/Users/../acados/include/acados -I/Users/../acados/include/blasfeo/include -I/Users/../acados/include/hpipm/include -c -o pendulum_ode_model/pendulum_ode_impl_dae_fun_jac_x_xdot_z.o pendulum_ode_model/pendulum_ode_impl_dae_fun_jac_x_xdot_z.c
cc -fPIC -std=c99 -O2 -I/Users/../acados/include -I/Users/../acados/include/acados -I/Users/../acados/include/blasfeo/include -I/Users/../acados/include/hpipm/include -c -o pendulum_ode_model/pendulum_ode_impl_dae_jac_x_xdot_u_z.o pendulum_ode_model/pendulum_ode_impl_dae_jac_x_xdot_u_z.c
cc -shared acados_solver_pendulum_ode.o pendulum_ode_model/pendulum_ode_impl_dae_fun.o pendulum_ode_model/pendulum_ode_impl_dae_fun_jac_x_xdot_z.o pendulum_ode_model/pendulum_ode_impl_dae_jac_x_xdot_u_z.o -o libacados_ocp_solver_pendulum_ode.dylib -L/Users/../acados/lib -lacados -lhpipm -lblasfeo -lm \
-L -l
ld: warning: directory not found for option '-L-l'
Traceback (most recent call last):
File "/Users/../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/../acados/interfaces/acados_template/acados_template/acados_ocp_solver.py", line 953, in __init__
self.__acados_lib = CDLL(libacados_filepath)
File "/Users/williamz/opt/miniconda3/envs/acados36/lib/python3.6/ctypes/__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/../acados/lib/libacados.dylib, 0x0006): Library not loaded: libqpOASES_e.3.1.dylib
Referenced from: <29AD1B35-7BE7-3135-AB46-1457EE26BE87> /Users/../acados/lib/libacados.dylib
Reason: tried: 'libqpOASES_e.3.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibqpOASES_e.3.1.dylib' (no such file), '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, not in dyld cache), '/Users/../acados/examples/acados_python/getting_started/ocp/libqpOASES_e.3.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/../acados/examples/acados_python/getting_started/ocp/libqpOASES_e.3.1.dylib' (no such file), '/Users/../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, not in dyld cache)
A similar issue occurred for running the example in PyCharm. I tried to use the following meothod to resolve this issue, but I still get the following error.
rm -f libacados_ocp_solver_pendulum_ode.dylib
rm -f acados_solver_pendulum_ode.o
cc -fPIC -std=c99 -O2 -I/Users/../acados/include -I/Users/../acados/include/acados -I/Users/../acados/include/blasfeo/include -I/Users/../acados/include/hpipm/include -c -o acados_solver_pendulum_ode.o acados_solver_pendulum_ode.c
cc -fPIC -std=c99 -O2 -I/Users/../acados/include -I/Users/../acados/include/acados -I/Users/../acados/include/blasfeo/include -I/Users/../acados/include/hpipm/include -c -o pendulum_ode_model/pendulum_ode_impl_dae_fun.o pendulum_ode_model/pendulum_ode_impl_dae_fun.c
cc -fPIC -std=c99 -O2 -I/Users/../acados/include -I/Users/../acados/include/acados -I/Users/../acados/include/blasfeo/include -I/Users/../acados/include/hpipm/include -c -o pendulum_ode_model/pendulum_ode_impl_dae_fun_jac_x_xdot_z.o pendulum_ode_model/pendulum_ode_impl_dae_fun_jac_x_xdot_z.c
cc -fPIC -std=c99 -O2 -I/Users/../acados/include -I/Users/../acados/include/acados -I/Users/../acados/include/blasfeo/include -I/Users/../acados/include/hpipm/include -c -o pendulum_ode_model/pendulum_ode_impl_dae_jac_x_xdot_u_z.o pendulum_ode_model/pendulum_ode_impl_dae_jac_x_xdot_u_z.c
cc -shared acados_solver_pendulum_ode.o pendulum_ode_model/pendulum_ode_impl_dae_fun.o pendulum_ode_model/pendulum_ode_impl_dae_fun_jac_x_xdot_z.o pendulum_ode_model/pendulum_ode_impl_dae_jac_x_xdot_u_z.o -o libacados_ocp_solver_pendulum_ode.dylib -L/Users/../acados/lib -lacados -lhpipm -lblasfeo -lm \
-L -l
ld: warning: directory not found for option '-L-l'
Traceback (most recent call last):
File "/Users/../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/../acados/interfaces/acados_template/acados_template/acados_ocp_solver.py", line 953, in __init__
self.__acados_lib = CDLL(libacados_filepath)
File "/Users/williamz/opt/miniconda3/envs/acados36/lib/python3.6/ctypes/__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/../acados/lib/libacados.dylib, 0x0006): Library not loaded: libqpOASES_e.3.1.dylib
Referenced from: <29AD1B35-7BE7-3135-AB46-1457EE26BE87> /Users/../acados/lib/libacados.dylib
Reason: tried: 'libqpOASES_e.3.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibqpOASES_e.3.1.dylib' (no such file), '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, not in dyld cache), '/Users/../acados/examples/acados_python/getting_started/ocp/libqpOASES_e.3.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/../acados/examples/acados_python/getting_started/ocp/libqpOASES_e.3.1.dylib' (no such file), '/Users/../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, not in dyld cache)
Process finished with exit code 1
I think things are just not as expected when you have those environment managers.
I guess the path gets changed somehow.
Can you try to export ACADOS_SOURCE_DIR.
Or provide acados_path as a keyword argument to AcadosOcp
Otherwise this function is called.
Or provide acados_path as a keyword argument to AcadosOcp
Regarding this point, do you mean providing a keyword argument to ocp = AcadosOcp() in the example file? Can you be more specific regarding how to provide this path to it?
I have the following warning in the Python console, though.
Warning: Did not find environment variable ACADOS_SOURCE_DIR, guessed ACADOS_PATH to be /Users/acados.
Please export ACADOS_SOURCE_DIR to avoid this warning.
And also this:
acados was compiled without OpenMP.
I know that these may not all be relevant for the current issue, they are posted here mainly for my future reference.