Tim-Salzmann / l4casadi

Use PyTorch Models with CasADi for data-driven optimization or learning-based optimal control. Supports Acados.
MIT License
370 stars 28 forks source link

I encountered a problem when executing the "pip install l4casadi --no-build-isolation" command, what should I do? #30

Closed tuomas-123 closed 6 months ago

tuomas-123 commented 6 months ago

An error occurred while configuring with CMake. Command: 'C:\ProgramData\Anaconda3\envs\l4casadi\lib\site-packages\cmake\data\bin/cmake.exe' 'C:\Users\user\AppData\Local\Temp\pip-install-csyt4_35\l4casadi_1acbdd3d21dd4f379862581db11111ec\libl4 casadi' -G Ninja '-DCMAKE_MAKE_PROGRAM:FILEPATH=C:\ProgramData\Anaconda3\envs\l4casadi\lib\site-packages\ninja\data\bin\ninja' -D_SKBUILD_FORCE_MSVC=1930 --no-warn-unused-cli '-DCMAKE_INSTALL_PREF IX:PATH=C:\Users\user\AppData\Local\Temp\pip-install-csyt4_35\l4casadi_1acbdd3d21dd4f379862581db11111ec_skbuild\win-amd64-3.9\cmake-install' -DPYTHON_VERSION_STRING:STRING=3.9.19 -DSKBUILD:INTERN AL=TRUE '-DCMAKE_MODULE_PATH:PATH=C:\ProgramData\Anaconda3\envs\l4casadi\lib\site-packages\skbuild\resources\cmake' '-DPYTHON_EXECUTABLE:PATH=C:\ProgramData\Anaconda3\envs\l4casadi\python.exe' '-D PYTHON_INCLUDE_DIR:PATH=C:\ProgramData\Anaconda3\envs\l4casadi\Include' '-DPYTHON_LIBRARY:PATH=C:\ProgramData\Anaconda3\envs\l4casadi\libs\python39.lib' '-DPython_EXECUTABLE:PATH=C:\ProgramData\An aconda3\envs\l4casadi\python.exe' '-DPython_ROOT_DIR:PATH=C:\ProgramData\Anaconda3\envs\l4casadi' -DPython_FIND_REGISTRY:STRING=NEVER '-DPython_INCLUDE_DIR:PATH=C:\ProgramData\Anaconda3\envs\l4cas adi\Include' '-DPython_LIBRARY:PATH=C:\ProgramData\Anaconda3\envs\l4casadi\libs\python39.lib' '-DPython_NumPy_INCLUDE_DIRS:PATH=C:\ProgramData\Anaconda3\envs\l4casadi\lib\site-packages\numpy\core\ include' '-DPython3_EXECUTABLE:PATH=C:\ProgramData\Anaconda3\envs\l4casadi\python.exe' '-DPython3_ROOT_DIR:PATH=C:\ProgramData\Anaconda3\envs\l4casadi' -DPython3_FIND_REGISTRY:STRING=NEVER '-DPyth on3_INCLUDE_DIR:PATH=C:\ProgramData\Anaconda3\envs\l4casadi\Include' '-DPython3_LIBRARY:PATH=C:\ProgramData\Anaconda3\envs\l4casadi\libs\python39.lib' '-DPython3_NumPy_INCLUDE_DIRS:PATH=C:\Program Data\Anaconda3\envs\l4casadi\lib\site-packages\numpy\core\include' '-DCMAKE_MAKE_PROGRAM:FILEPATH=C:\ProgramData\Anaconda3\envs\l4casadi\lib\site-packages\ninja\data\bin\ninja' '-DCMAKE_TORCH_PATH=C:\Users\user\AppData\Roaming\Python\Python39\site-packages\torch' -DCMAKE_BUILD_TYPE:STRING=Release Source directory: C:\Users\user\AppData\Local\Temp\pip-install-csyt4_35\l4casadi_1acbdd3d21dd4f379862581db11111ec\libl4casadi Working directory: C:\Users\user\AppData\Local\Temp\pip-install-csyt4_35\l4casadi_1acbdd3d21dd4f379862581db11111ec_skbuild\win-amd64-3.9\cmake-build Please see CMake's output for more information.

  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for l4casadi Failed to build l4casadi ERROR: Could not build wheels for l4casadi, which is required to install pyproject.toml-based projects

Tim-Salzmann commented 6 months ago

Hi,

This looks like it is on a Windows system? Unfortunately, I do not have access to a Windows system. Thus, L4CasADi does not officially support Windows. I tried it some weeks ago but could not get it to work in a reasonable timeframe.

Best Tim

tuomas-123 commented 6 months ago

Thank you very much,Tim I tried using an ubuntu system and am currently configuring acados. Thank you so much for your work, l4casadi is a great tool!

tuomas-123 commented 6 months ago

Hi,Tim I have a few new inquiries I'd like to consult you about.

  1. When installing acados, I encountered the following error while running the command 'make examples_c'. Do you have any good solutions to resolve this? g++ -o dense_qp.out dense_qp.o -L/home/ubuntu2004/acados/lib -lacados -lhpipm -lblasfeo -lm -lblas -llapack /usr/bin/ld: /home/ubuntu2004/acados/lib/libacados.so: undefined reference to `ocp_nlp_ddp_config_initialize_default' collect2: error: ld returned 1 exit status 2.When executing 'simple_nlp.py', I encountered such an issue, unsure how to address it. File "/home/ubuntu2004/l4casadi/l4casadi/examples/simple_nlp.py", line 17, in f = l4c.L4CasADi(f, name='f', model_expects_batch_dim=False)(x) File "/home/ubuntu2004/miniconda3/envs/l4casadi/lib/python3.9/site-packages/l4casadi/l4casadi.py", line 120, in call return self.forward(*args) File "/home/ubuntu2004/miniconda3/envs/l4casadi/lib/python3.9/site-packages/l4casadi/l4casadi.py", line 135, in forward self.build(inp) File "/home/ubuntu2004/miniconda3/envs/l4casadi/lib/python3.9/site-packages/l4casadi/l4casadi.py", line 168, in build self.generate(inp) File "/home/ubuntu2004/miniconda3/envs/l4casadi/lib/python3.9/site-packages/l4casadi/l4casadi.py", line 183, in generate self._generate_cpp_function_template(rows, cols, has_jac, has_hess) File "/home/ubuntu2004/miniconda3/envs/l4casadi/lib/python3.9/site-packages/l4casadi/l4casadi.py", line 206, in _generate_cpp_function_template raise ValueError(f"""L4CasADi requires the model output to be a matrix (2 dimensions) but has ValueError: L4CasADi requires the model output to be a matrix (2 dimensions) but has 1 dimensions. For models which expects a batch dimension, the output should be a matrix of [1, d]. Thank you very much for promptly addressing my inquiries. Wishing you smooth workflow and joy every day.
Tim-Salzmann commented 6 months ago

Hi,

  1. Sounds like this problem is with Acados and unrelated to L4CasADi? If so I suggest to seek help on the Acados Forum. Sounds like some linking error to me.
  2. The examples was indeed broken. I just did a commit fixing it.

Hope this helps

Tim

tuomas-123 commented 6 months ago

Thanks again for your answer. l4casadi really helped me a lot.

hope you happy every day

tuomas