Hello!
I have an issue on doing a fresh install of acados Python
interface. My current goal is to be able to run the minimal_example_ocp.py
in its home directory as specified in this guide. As mentioned in the title I am on a fresh Ubuntu 22.04 machine using Python3.10 and I just started this process today.
I have followed the CMake installation guide without any issues. The acados dir is installed in my home directory. I then started to install the Python interface by creating a virtual environment in ~/acados
:
python -m venv env
source env/bin/activate
I then installed the acados_template
python package as shown in the guide:
pip install -e ~/acados/interfaces/acados_template
Then add the paths as follows in my ~/.bashrc
:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"~/acados/lib"
export ACADOS_SOURCE_DIR="~/acados"
What comes next is where the issues truly arise sadly:
cd ~/acados/examples/acados_python/getting_started/
python minimal_example_ocp.py
Is ran, and I am greeted by three of these warnings
:
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: Please note that the following versions of CasADi are officially supported: 3.4.03.4.5 or 3.5.1 or 3.5.2 or 3.5.3 or 3.5.4 or 3.5.6 or 3.5.5 or 3.6.0 or 3.6.1 or 3.6.2 or 3.6.3 or 3.6.4.
If there is an incompatibility with the CasADi generated code, please consider changing your CasADi version.
Version 3.6.5 currently in use.
Then I am prompted to automatically set up the Tera renderer to which I agree yes to, but am immediately given this error:
Do you wish to set up Tera renderer automatically?
y/N? (press y to download tera or any key for manual installation)
y
Creating directory ~/acados/bin
Dowloading https://github.com/acados/tera_renderer/releases/download/v0.0.34/t_renderer-v0.0.34-linux
Successfully downloaded t_renderer.
Successfully downloaded t_renderer.
sh: 1: /home/roy/acados/bin/t_renderer: not found
Traceback (most recent call last):
File "/home/roy/acados/examples/acados_python/getting_started/minimal_example_ocp.py", line 105, in <module>
main()
File "/home/roy/acados/examples/acados_python/getting_started/minimal_example_ocp.py", line 84, in main
ocp_solver = AcadosOcpSolver(ocp, json_file = 'acados_ocp.json')
File "/home/roy/acados/interfaces/acados_template/acados_template/acados_ocp_solver.py", line 199, in __init__
self.generate(acados_ocp, json_file=json_file, simulink_opts=simulink_opts, cmake_builder=cmake_builder)
File "/home/roy/acados/interfaces/acados_template/acados_template/acados_ocp_solver.py", line 118, in generate
acados_ocp.render_templates(json_file, cmake_builder=cmake_builder)
File "/home/roy/acados/interfaces/acados_template/acados_template/acados_ocp.py", line 900, in render_templates
render_template(tup[0], tup[1], output_dir, json_path)
File "/home/roy/acados/interfaces/acados_template/acados_template/utils.py", line 292, in render_template
raise Exception(f'Rendering of {in_file} failed!\n\nAttempted to execute OS command:\n{os_cmd}\n\n')
Exception: Rendering of main.in.c failed!
Attempted to execute OS command:
~/acados/bin/t_renderer '/home/roy/acados/interfaces/acados_template/acados_template/c_templates_tera/**/*' 'main.in.c' '/home/roy/acados/examples/acados_python/getting_started/acados_ocp.json' 'main_pendulum_ode.c'
At this point I noticed that my ~/acados/bin
is actually still empty despite the Successfully downloaded t_renderer.
message appearing twice. So I do what some other posts suggested and downloaded the latest stable release, renamed it to t_renderer
, gave it permissions with chmod +x t_renderer
, and placed it in ~/acados/bin
. I resource the acados paths as seen above.
Next I then go back to the getting_started
directory and rerun the same Python script. However, I am greeted with the same error of not finding t_renderer and asking me to download/setup it:
Tera template render executable not found, while looking in path:
~/acados/bin/t_renderer
In order to be able to render the templates, you need to download the tera renderer binaries from:
https://github.com/acados/tera_renderer/releases
Do you wish to set up Tera renderer automatically?
y/N? (press y to download tera or any key for manual installation)
Pressing N
of course gives me the nice instructions to do it manually, but when pressing ‘y’ the set up prompt is asked twice, and I accept both times:
Do you wish to set up Tera renderer automatically?
y/N? (press y to download tera or any key for manual installation)
y
Creating directory ~/acados/bin
Dowloading https://github.com/acados/tera_renderer/releases/download/v0.0.34/t_renderer-v0.0.34-linux
Successfully downloaded t_renderer.
Successfully downloaded t_renderer.
Tera template render executable not found, while looking in path:
~/acados/bin/t_renderer
In order to be able to render the templates, you need to download the tera renderer binaries from:
https://github.com/acados/tera_renderer/releases
Do you wish to set up Tera renderer automatically?
y/N? (press y to download tera or any key for manual installation)
y
Creating directory ~/acados/bin
Dowloading https://github.com/acados/tera_renderer/releases/download/v0.0.34/t_renderer-v0.0.34-linux
Successfully downloaded t_renderer.
Successfully downloaded t_renderer.
rm -f libacados_ocp_solver_pendulum_ode.so
rm -f pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun_jac.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun_jac_hess.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun_jac.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun_jac_hess.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun_jac.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun_jac_hess.o acados_solver_pendulum_ode.o
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/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
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun_jac.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun_jac.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun_jac_hess.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun_jac_hess.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun_jac.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun_jac.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun_jac_hess.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun_jac_hess.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun_jac.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun_jac.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun_jac_hess.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun_jac_hess.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o acados_solver_pendulum_ode.o acados_solver_pendulum_ode.c
acados_solver_pendulum_ode.c:37:10: fatal error: acados_c/ocp_nlp_interface.h: No such file or directory
37 | #include "acados_c/ocp_nlp_interface.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: acados_solver_pendulum_ode.o] Error 1
Traceback (most recent call last):
File "/home/roy/acados/examples/acados_python/getting_started/minimal_example_ocp.py", line 105, in <module>
main()
File "/home/roy/acados/examples/acados_python/getting_started/minimal_example_ocp.py", line 84, in main
ocp_solver = AcadosOcpSolver(ocp, json_file = 'acados_ocp.json')
File "/home/roy/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 "/home/roy/acados/interfaces/acados_template/acados_template/utils.py", line 125, in get_shared_lib
shared_lib = DllLoader(shared_lib_name)
File "/usr/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: ~/acados/lib/../lib/libacados.so: cannot open shared object file: No such file or directory
At this point this point, the system can see that I do have t_renderer
but now it continuously gives back the last part of the most recent error:
rm -f libacados_ocp_solver_pendulum_ode.so
rm -f pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun_jac.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun_jac_hess.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun_jac.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun_jac_hess.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun_jac.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun_jac_hess.o acados_solver_pendulum_ode.o
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/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
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun_jac.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun_jac.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun_jac_hess.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_0_fun_jac_hess.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun_jac.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun_jac.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun_jac_hess.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_fun_jac_hess.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun_jac.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun_jac.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun_jac_hess.o pendulum_ode_cost/pendulum_ode_cost_ext_cost_e_fun_jac_hess.c
cc -fPIC -std=c99 -O2 -I~/acados/include -I~/acados/include/acados -I~/acados/include/blasfeo/include -I~/acados/include/hpipm/include -c -o acados_solver_pendulum_ode.o acados_solver_pendulum_ode.c
acados_solver_pendulum_ode.c:37:10: fatal error: acados_c/ocp_nlp_interface.h: No such file or directory
37 | #include "acados_c/ocp_nlp_interface.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: acados_solver_pendulum_ode.o] Error 1
Traceback (most recent call last):
File "/home/roy/acados/examples/acados_python/getting_started/minimal_example_ocp.py", line 105, in <module>
main()
File "/home/roy/acados/examples/acados_python/getting_started/minimal_example_ocp.py", line 84, in main
ocp_solver = AcadosOcpSolver(ocp, json_file = 'acados_ocp.json')
File "/home/roy/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 "/home/roy/acados/interfaces/acados_template/acados_template/utils.py", line 125, in get_shared_lib
shared_lib = DllLoader(shared_lib_name)
File "/usr/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: ~/acados/lib/../lib/libacados.so: cannot open shared object file: No such file or directory
This missing acados_c/ocp_nlp_interface.h
error persists with any of the getting_started
python scripts. This was all done while I was in the env
virtual environment.
I am fairly new to this whole process and the field of nonlinear optimal control. I am very much excited to learn! I apologize if my post is too verbose, I was hoping to be as detailed as possible so that the problem I am having would be clear.
Thank you very much to anyone who replies and to anyone in the future who has similar problems I wish you the best of luck!