Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrate with LeRobot #345

Open
boczekbartek opened this issue Dec 11, 2024 · 10 comments
Open

integrate with LeRobot #345

boczekbartek opened this issue Dec 11, 2024 · 10 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@boczekbartek
Copy link
Member

boczekbartek commented Dec 11, 2024

Is your feature request related to a problem? Please describe.
Currently rai-manipulation-demo uses ros2 moveit and a fusion of segmentation with depth camera to control Panda robotic arm.
This approach is good to for reasoning and planning, but might be limited when it comes to more complex movements of the gripper. For such task, policies implemented in LeRobot can be more useful.

LeRobot currently offers:

  • 4 pre-trained policies listed in Models section: link
  • scripts for policies training: link
  • dataset format for training policies: link

Describe the solution you'd like
I find the integration of all LeRobot features mentioned above useful in rai, but I think a step-by-step should be applied.

  • First logical step would be to attach pre-trained policy to the rai agent as a tool.
  • Next would be to determine what policies would be useful for manipulation agent and to train them on datasets curated in simulation.
  • Next step would be to generate and record trajectories for training using rai and text descriptions

Describe alternatives you've considered

Additional context

@boczekbartek boczekbartek added the enhancement New feature or request label Dec 11, 2024
@adamdbrw adamdbrw added the help wanted Extra attention is needed label Dec 11, 2024
@vmayoral
Copy link

Hi there,

I'm happy spending some cycles in exploring and potentially contributing to this. I've got some experience with LeRobot (participated in their last hackathon last Oct and ported it to a new robot as part of the effort which I contributed back) which should help in this endeavour.

  • First logical step would be to attach pre-trained policy to the rai agent as a tool.
  • Next would be to determine what policies would be useful for manipulation agent and to train them on datasets curated in simulation.
  • Next step would be to record generate trajectories for training using rai and text descriptions

For now, I'll take on the first task, which is in-line with my research interests. I can't commit to the other two now but I'm happy to see how far my cycles can take me. Question though, what do you mean by:

Next step would be to record generate trajectories for training using rai and text descriptions

Don't quite get the meaning behind it.

I may have some questions @boczekbartek concerning the rai-manipulation-demo. I guess the discord server of the Embodied AI WG is the best place for discussion?

@boczekbartek
Copy link
Member Author

boczekbartek commented Dec 13, 2024

@vmayoral
That's awesome to hear! Having someone with hands on experience with LeRobot to work on this issue is a best case scenario. Your contribution here would be very welcome!

Next step would be to record generate trajectories for training using rai and text descriptions

( I adjusted the wording a bit in the description to make it more clear.)

My idea for this was to use the pipeline of the current rai-manipulation-demo (with LLM tools that are based on moveit and groundedSAM) to generate trajectories for imitation learning in LeRobot. From training on these trajectories we could get more robust policies.
Does it make sense to you?

Also, if you have suggestions for the trajectory for this issue please share them. We can figure out together what makes the most sense.

As for the rai-manipulation-demo (and basically other questions about rai / llm agents ) - yes, please write us on Discord. Also for questions specifically about the demo you could also use this issue: #292. We'll be happy to help!

@vmayoral
Copy link

Does it make sense to you?

Thanks, it does now.

Looking to engage into all of this later this week. Will report back here.

@vmayoral
Copy link

Hi all,

Thought it took a bit longer than I was expecting initially, I was positively hoping to report a small success integrating a LeRobot policy into RAI. Unfortunately this turned frustrating Altogether, I have not been able to integrate LeRobot policies into RAI ❌ because honestly, I have not been able to get RAI to operate. No blaming, just reporting my personal experience here and hoping to retry again in the future if time allows for it. Here's my experience:

Setting up the policy and tools for "integration"

I built a small policy using ACT (one of the provided algorithms within LeRobot) that successfully converges both gradient and loss-wise. The performance of the policy is reasonable and "prepared" to be chain with other traditional manipulation behaviors leveraging optimal control (e.g. via ROS 2). I've worked with real robots, as it's more fun. Here's the current policy operating to place the rubber plate in the desired position. Handling such material is rather challenging generally:

top left right
https://github.com/user-attachments/assets/cdb87412-435d-4754-b7ee-ace9ee7b6f45 https://github.com/user-attachments/assets/feb2c99a-76bd-4e61-a10f-94275ce7ddc3 https://github.com/user-attachments/assets/b3f5b31e-8717-4808-9a80-88e1a2e47924

With this operational, I tested this outside of RAI and ROS 2. A simple Python script can trigger this policy by leveraging the control_loop function LeRobot provides while passing the right trained policy (or if you wish to leverage higher level control, you can look into LeRobot's record)

Integrating the policy into RAI

Unfortunately, things turned difficult here. The struggles with RAI got me to spend a very significant amount of time on troubleshooting. I'm listing below my approach and some notes of the process:

Major issues experienced:

❌ Issue 0: a) while launching configurator.py, PortAudio missing and b) later further issues
2025-01-18 10:46:50.453 Uncaught app execution
Traceback (most recent call last):
  File "/home/dragon/.cache/pypoetry/virtualenvs/rai-3Vgzn0Ug-py3.12/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling
    result = func()
             ^^^^^^
  File "/home/dragon/.cache/pypoetry/virtualenvs/rai-3Vgzn0Ug-py3.12/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 579, in code_to_exec
    exec(code, module.__dict__)
  File "/home/dragon/rai/src/rai/rai/utils/configurator.py", line 21, in <module>
    import sounddevice as sd
  File "/home/dragon/.cache/pypoetry/virtualenvs/rai-3Vgzn0Ug-py3.12/lib/python3.12/site-packages/sounddevice.py", line 71, in <module>
    raise OSError('PortAudio library not found')
OSError: PortAudio library not found
^C  Stopping...
poetry run streamlit run src/rai/rai/utils/configurator.py
Traceback (most recent call last):
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/cleo/application.py", line 327, in run
    exit_code = self._run(io)
                ^^^^^^^^^^^^^
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/console/application.py", line 188, in _run
    self._load_plugins(io)
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/console/application.py", line 354, in _load_plugins
    manager.load_plugins()
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/plugins/plugin_manager.py", line 38, in load_plugins
    self._load_plugin_entry_point(ep)
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/plugins/plugin_manager.py", line 76, in _load_plugin_entry_point
    plugin = ep.load()  # type: ignore[no-untyped-call]
             ^^^^^^^^^
  File "/home/dragon/miniconda3/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dragon/miniconda3/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry_plugin_export/plugins.py", line 7, in <module>
    from poetry_plugin_export.command import ExportCommand
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry_plugin_export/command.py", line 12, in <module>
    from poetry_plugin_export.exporter import Exporter
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry_plugin_export/exporter.py", line 11, in <module>
    from poetry.repositories.http_repository import HTTPRepository
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/repositories/http_repository.py", line 23, in <module>
    from poetry.inspection.info import PackageInfo
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/inspection/info.py", line 26, in <module>
    from poetry.utils.env import EnvCommandError
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/utils/env/__init__.py", line 9, in <module>
    from poetry.utils.env.base_env import Env
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/utils/env/base_env.py", line 15, in <module>
    from virtualenv.seed.wheels.embed import get_embed_wheel
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/virtualenv/__init__.py", line 3, in <module>
    from .run import cli_run, session_via_cli
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/virtualenv/run/__init__.py", line 7, in <module>
    from virtualenv.app_data import make_app_data
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/virtualenv/app_data/__init__.py", line 10, in <module>
    from .na import AppDataDisabled
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/virtualenv/app_data/na.py", line 5, in <module>
    from .base import AppData, ContentStore
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/virtualenv/app_data/base.py", line 8, in <module>
    from virtualenv.info import IS_ZIPAPP
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/virtualenv/info.py", line 9, in <module>
    IMPLEMENTATION = platform.python_implementation()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dragon/miniconda3/lib/python3.12/platform.py", line 1153, in python_implementation
    return _sys_version()[0]
           ^^^^^^^^^^^^^^
  File "/home/dragon/miniconda3/lib/python3.12/platform.py", line 1113, in _sys_version
    raise ValueError(
ValueError: failed to parse CPython sys.version: '3.12.8 | packaged by Anaconda, Inc. | (main, Dec 11 2024, 16:31:09) [GCC 11.2.0]'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dragon/.local/bin/poetry", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/console/application.py", line 411, in main
    exit_code: int = Application().run()
                     ^^^^^^^^^^^^^^^^^^^
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/cleo/application.py", line 338, in run
    self.render_error(e, io)
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/console/application.py", line 180, in render_error
    self.set_solution_provider_repository(self._get_solution_provider_repository())
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/console/application.py", line 400, in _get_solution_provider_repository
    from poetry.mixology.solutions.providers.python_requirement_solution_provider import (
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/mixology/solutions/providers/__init__.py", line 3, in <module>
    from poetry.mixology.solutions.providers.python_requirement_solution_provider import (
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/mixology/solutions/providers/python_requirement_solution_provider.py", line 9, in <module>
    from poetry.puzzle.exceptions import SolverProblemError
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/puzzle/__init__.py", line 3, in <module>
    from poetry.puzzle.solver import Solver
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/puzzle/solver.py", line 16, in <module>
    from poetry.puzzle.provider import Indicator
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/puzzle/provider.py", line 27, in <module>
    from poetry.packages.direct_origin import DirectOrigin
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/packages/direct_origin.py", line 10, in <module>
    from poetry.inspection.info import PackageInfo
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/inspection/info.py", line 26, in <module>
    from poetry.utils.env import EnvCommandError
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/utils/env/__init__.py", line 9, in <module>
    from poetry.utils.env.base_env import Env
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/utils/env/base_env.py", line 15, in <module>
    from virtualenv.seed.wheels.embed import get_embed_wheel
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/virtualenv/__init__.py", line 3, in <module>
    from .run import cli_run, session_via_cli
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/virtualenv/run/__init__.py", line 7, in <module>
    from virtualenv.app_data import make_app_data
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/virtualenv/app_data/__init__.py", line 10, in <module>
    from .na import AppDataDisabled
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/virtualenv/app_data/na.py", line 5, in <module>
    from .base import AppData, ContentStore
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/virtualenv/app_data/base.py", line 8, in <module>
    from virtualenv.info import IS_ZIPAPP
  File "/home/dragon/.local/share/pypoetry/venv/lib/python3.12/site-packages/virtualenv/info.py", line 9, in <module>
    IMPLEMENTATION = platform.python_implementation()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dragon/miniconda3/lib/python3.12/platform.py", line 1153, in python_implementation
    return _sys_version()[0]
           ^^^^^^^^^^^^^^
  File "/home/dragon/miniconda3/lib/python3.12/platform.py", line 1113, in _sys_version
    raise ValueError(
ValueError: failed to parse CPython sys.version: '3.12.8 | packaged by Anaconda, Inc. | (main, Dec 11 2024, 16:31:09) [GCC 11.2.0]'
❌ Issue 1: dealt installing "em"
/usr/lib/python3/dist-packages/setuptools/dist.py:723: UserWarning: Usage of dash-separated 'script-dir' will not be supported in future versions. Please use the underscore name 'script_dir' instead
  warnings.warn(
/usr/lib/python3/dist-packages/setuptools/dist.py:723: UserWarning: Usage of dash-separated 'install-scripts' will not be supported in future versions. Please use the underscore name 'install_scripts' instead
  warnings.warn(
--- stderr: rai_interfaces
CMake Error at /opt/ros/humble/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:59 (message):
  execute_process(/home/dragon/miniconda3/bin/python3 -m rosidl_adapter
  --package-name rai_interfaces --arguments-file
  /home/dragon/rai/build/rai_interfaces/rosidl_adapter__arguments__rai_interfaces.json
  --output-dir
  /home/dragon/rai/build/rai_interfaces/rosidl_adapter/rai_interfaces
  --output-file
  /home/dragon/rai/build/rai_interfaces/rosidl_adapter/rai_interfaces.idls)
  returned error code 1:

  Traceback (most recent call last):

    File "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/__main__.py", line 19, in <module>
      sys.exit(main())
               ^^^^^^
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/main.py", line 53, in main
      abs_idl_file = convert_to_idl(
                     ^^^^^^^^^^^^^^^
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/__init__.py", line 23, in convert_to_idl
      from rosidl_adapter.srv import convert_srv_to_idl
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/srv/__init__.py", line 16, in <module>
      from rosidl_adapter.resource import expand_template
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/resource/__init__.py", line 19, in <module>
      import em

  ModuleNotFoundError: No module named 'em'

Call Stack (most recent call first):
  /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:130 (rosidl_adapt_interfaces)
  CMakeLists.txt:19 (rosidl_generate_interfaces)
❌ Issue 2: Downgraded to empy==3.3.4
--- stderr: rai_interfaces
CMake Error at /opt/ros/humble/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:59 (message):
  execute_process(/home/dragon/miniconda3/bin/python3 -m rosidl_adapter
  --package-name rai_interfaces --arguments-file
  /home/dragon/rai/build/rai_interfaces/rosidl_adapter__arguments__rai_interfaces.json
  --output-dir
  /home/dragon/rai/build/rai_interfaces/rosidl_adapter/rai_interfaces
  --output-file
  /home/dragon/rai/build/rai_interfaces/rosidl_adapter/rai_interfaces.idls)
  returned error code 1:

  AttributeError processing template 'srv.idl.em'

  Traceback (most recent call last):

    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/resource/__init__.py", line 48, in evaluate_template
      _interpreter = em.Interpreter(
                     ^^^^^^^^^^^^^^

  AttributeError: module 'em' has no attribute 'Interpreter'



  During handling of the above exception, another exception occurred:



  Traceback (most recent call last):

    File "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/__main__.py", line 19, in <module>
      sys.exit(main())
               ^^^^^^
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/main.py", line 53, in main
      abs_idl_file = convert_to_idl(
                     ^^^^^^^^^^^^^^^
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/__init__.py", line 24, in convert_to_idl
      return convert_srv_to_idl(
             ^^^^^^^^^^^^^^^^^^^
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/srv/__init__.py", line 39, in convert_srv_to_idl
      expand_template('srv.idl.em', data, output_file, encoding='iso-8859-1')
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/resource/__init__.py", line 23, in expand_template
      content = evaluate_template(template_name, data)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/resource/__init__.py", line 69, in evaluate_template
      _interpreter.shutdown()
      ^^^^^^^^^^^^^^^^^^^^^

  AttributeError: 'NoneType' object has no attribute 'shutdown'

Call Stack (most recent call first):
  /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:130 (rosidl_adapt_interfaces)
  CMakeLists.txt:19 (rosidl_generate_interfaces)
❌ Issue 3: installed "lark" with pip
--- stderr: rai_interfaces
Traceback (most recent call last):
  File "/opt/ros/humble/share/rosidl_generator_c/cmake/../../../lib/rosidl_generator_c/rosidl_generator_c", line 8, in <module>
    from rosidl_generator_c import generate_c
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_generator_c/__init__.py", line 15, in <module>
    from rosidl_cmake import convert_camel_case_to_lower_case_underscore
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_cmake/__init__.py", line 24, in <module>
    from rosidl_parser.parser import parse_idl_file
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_parser/parser.py", line 20, in <module>
    from lark import Lark
ModuleNotFoundError: No module named 'lark'
Traceback (most recent call last):
  File "/opt/ros/humble/share/rosidl_generator_cpp/cmake/../../../lib/rosidl_generator_cpp/rosidl_generator_cpp", line 8, in <module>
    from rosidl_generator_cpp import generate_cpp
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_generator_cpp/__init__.py", line 17, in <module>
    from rosidl_cmake import generate_files
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_cmake/__init__.py", line 24, in <module>
    from rosidl_parser.parser import parse_idl_file
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_parser/parser.py", line 20, in <module>
    from lark import Lark
ModuleNotFoundError: No module named 'lark'
gmake[2]: *** [CMakeFiles/rai_interfaces__rosidl_generator_c.dir/build.make:206: rosidl_generator_c/rai_interfaces/srv/manipulator_move_to.h] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:212: CMakeFiles/rai_interfaces__rosidl_generator_c.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake[2]: *** [CMakeFiles/rai_interfaces__cpp.dir/build.make:252: rosidl_generator_cpp/rai_interfaces/srv/manipulator_move_to.hpp] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:265: CMakeFiles/rai_interfaces__cpp.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
❌ Issue 4: linking errors, missing symbols and/or libraries. See https://github.com/graphdeco-inria/gaussian-splatting/issues/152#issuecomment-1726202599
Finished <<< rai_tts [1.30s]
--- stderr: rai_whatisee
/usr/bin/ld: /lib/x86_64-linux-gnu/libnetcdf.so.19: undefined reference to `curl_global_cleanup@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_easy_getinfo@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_multi_cleanup@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_multi_perform@CURL_OPENSSL_4'
/usr/bin/ld: /lib/x86_64-linux-gnu/libnetcdf.so.19: undefined reference to `curl_global_init@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_easy_perform@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_mime_init@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_easy_init@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_multi_add_handle@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_multi_remove_handle@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_mime_addpart@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_version_info@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_mime_name@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_mime_filename@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_multi_info_read@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_slist_free_all@CURL_OPENSSL_4'
/usr/bin/ld: /lib/x86_64-linux-gnu/libnetcdf.so.19: undefined reference to `curl_easy_strerror@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_easy_setopt@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_slist_append@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_multi_poll@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_version@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_multi_setopt@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_mime_data@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_mime_free@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_easy_cleanup@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_multi_init@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_mime_data_cb@CURL_OPENSSL_4'
/usr/bin/ld: /lib/libgdal.so.30: undefined reference to `curl_multi_wait@CURL_OPENSSL_4'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/rai_whatisee_node.dir/build.make:271: rai_whatisee_node] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:137: CMakeFiles/rai_whatisee_node.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< rai_whatisee [0.52s, exited with code 2]
Aborted  <<< rai_whoami [0.56s]
Aborted  <<< rai_open_set_vision [0.57s]

Summary: 11 packages finished [1.56s]
  1 package failed: rai_whatisee
  2 packages aborted: rai_open_set_vision rai_whoami
  2 packages had stderr output: rai_hmi rai_whatisee
❌ Issue 5: more undefined symbol conflicts due to conda
Finished <<< rosbot_xl_whoami [1.41s]
--- stderr: robotic_manipulation
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `X509_STORE_CTX_init_rpk@OPENSSL_3.2.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `BIO_recvmmsg@OPENSSL_3.2.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `OSSL_ERR_STATE_restore@OPENSSL_3.2.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `OPENSSL_LH_set_thunks@OPENSSL_3.3.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `BIO_sendmmsg@OPENSSL_3.2.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `BIO_err_is_non_fatal@OPENSSL_3.2.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `BIO_get_rpoll_descriptor@OPENSSL_3.2.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `OSSL_ERR_STATE_free@OPENSSL_3.2.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `OSSL_STACK_OF_X509_free@OPENSSL_3.2.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `OSSL_ERR_STATE_save_to_mark@OPENSSL_3.2.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `OSSL_ERR_STATE_save@OPENSSL_3.2.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `BIO_get_wpoll_descriptor@OPENSSL_3.2.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `BIO_s_dgram_mem@OPENSSL_3.2.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `OSSL_ERR_STATE_new@OPENSSL_3.2.0'
/usr/bin/ld: /home/dragon/miniconda3/lib/libssl.so.3: undefined reference to `ERR_count_to_mark@OPENSSL_3.2.0'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/robotic_manipulation.dir/build.make:414: robotic_manipulation] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:137: CMakeFiles/robotic_manipulation.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
❌ Issue 6: streamlit not included in python deps, needs to be installed manually
Errors while launching streamlit run examples/manipulation-demo-streamlit.py
❌ Issue 7: langchain_core missing, again missing deps. Installed langchain
❌ Issue 8: langgraph missing, again missing deps. Installed langchain
❌ Issue 9: install issues or conflicts with rclpy._rclpy_pybind11
ModuleNotFoundError: No module named 'rclpy._rclpy_pybind11' The C extension '/opt/ros/humble/lib/python3.10/site-packages/_rclpy_pybind11.cpython-312-x86_64-linux-gnu.so' isn't present on the system. Please refer to 'https://docs.ros.org/en/humble/Guides/Installation-Troubleshooting.html#import-failing-without-library-present-on-the-system' for possible solutions
Traceback:

File "/home/dragon/rai/examples/manipulation-demo-streamlit.py", line 20, in <module>
    from rai.agents.integrations.streamlit import get_streamlit_cb, streamlit_invoke
File "/home/dragon/rai/build/rai/rai/__init__.py", line 15, in <module>
    from rai.apps.high_level_api import ROS2Agent
File "/home/dragon/rai/build/rai/rai/apps/high_level_api.py", line 20, in <module>
    from rai.agents.conversational_agent import create_conversational_agent
File "/home/dragon/rai/build/rai/rai/agents/__init__.py", line 15, in <module>
    from rai.agents.conversational_agent import create_conversational_agent
File "/home/dragon/rai/build/rai/rai/agents/conversational_agent.py", line 25, in <module>
    from rclpy.impl.rcutils_logger import RcutilsLogger
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/__init__.py", line 49, in <module>
    from rclpy.signals import install_signal_handlers
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/signals.py", line 15, in <module>
    from rclpy.exceptions import InvalidHandle
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/exceptions.py", line 15, in <module>
    from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/impl/implementation_singleton.py", line 32, in <module>
    rclpy_implementation = import_c_library('._rclpy_pybind11', package)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/ros/humble/lib/python3.10/site-packages/rpyutils/import_c_library.py", line 39, in import_c_library
    return importlib.import_module(name, package=package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dragon/miniconda3/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

At this point I run out of time (and patience). It took me much (much!) longer the troubleshooting of setting up RAI than I spent with the rest of the tasks (meaning setting up the robots, recording episodes through Imitation Learning, training, testing the policy and creating a silly wrapper for launching such policy at desire from a python wrapper with 10 LOC).

That said, I deeply respect and appreciate the tremendous effort and ingenuity that goes into creating tools like RAI. They are foundational to the field and enable so much innovation.

@maciejmajek
Copy link
Member

maciejmajek commented Jan 18, 2025

Hi @vmayoral,

Thank you for sharing your detailed experience and for taking the time to document the issues you encountered. I understand that you might have had Conda sourced or used it instead of Poetry. Unfortunately, we don’t support Conda and haven’t tested RAI in that environment. The framework is officially supported and tested with Poetry, and the issues you’ve described are likely linked to incompatibilities introduced by having Conda sourced during the setup.

The only issue I can directly relate to is the empy error, which can occur when building the repository for the first time in a custom Python environment. This is usually caused by package overshadowing, and we resolve it as outlined here: RAI Discussion #150.

To ensure that the installation process works as expected, we have continuous integration (CI) workflows in place. These CI pipelines are based on clean humble and jazzy OSRF Docker images. They test the entire installation process, verify that all packages can be imported correctly, and run a portion of RAI to confirm its functionality. This ensures that the framework is operable in the intended environment.

We’ve also received feedback from the community that similar issues have occurred, and the problems were not related to the Python environment itself but to other processes such as running demos, which we are fixing on on going basis. However, having Conda sourced can introduce subtle conflicts. To clarify, did you have a Conda environment active during your setup, even if you didn’t explicitly use Conda for the installation?

Regarding the integration with LeRobot, we deeply value the potential it brings to RAI, and your insights are incredibly helpful. We would love to collaborate further to address these challenges and potentially take on the work of adapting our environment to be compatible with LeRobot on our side. This integration is highly aligned with our vision, and your contribution would be instrumental in shaping how we move forward.

Once again, we’re sorry for the time and effort the troubleshooting process cost you, but we greatly appreciate your patience and detailed feedback. Let us know how we can best support you moving forward.

Thank you again for your efforts and kind words about RAI. We look forward to hearing back from you!

PS. I was able to run pip install -e . in lerobot directory while sourced into RAI's poetry shell without any issues. Using that configuration RAI tests passed.

@vmayoral
Copy link

vmayoral commented Jan 19, 2025

@maciejmajek thanks for the prompt response!

As you hint, I indeed had a conda env. Reason behind this is that despite pip install -e . gets the source code installed, gettings things to work and in-line with upstream development is a completely different story, at least in my experience with LeRobot. For what's worth, throughout my troubleshooting sessions, made various attempts to remove conda. I also tried a different approach which was to seek compatibility via a standalone version of Python (through pyenv, which I was hoping could marry better with poetry), but that failed for me too. Not saying it's not doable, just that it's turning terribly time consuming.

To my understanding, the whole issue boils down to a python compatibility issue, which I have not been able to solve.

To ensure that the installation process works as expected, we have continuous integration (CI) workflows in place. These CI pipelines are based on clean humble and jazzy OSRF Docker images. They test the entire installation process, verify that all packages can be imported correctly, and run a portion of RAI to confirm its functionality. This ensures that the framework is operable in the intended environment.

Is it possible to disclose such Dockerfile (or a simplified version of it) that helps others (e.g. me) reproduce the process of getting RAI up to speed?

@maciejmajek
Copy link
Member

As you hint, I indeed had a conda env. Reason behind this is that despite pip install -e . gets the source code installed, gettings things to work and in-line with upstream development is a completely different story, at least in my experience with LeRobot.

I see...

Is it possible to disclose such Dockerfile (or a simplified version of it) that helps others (e.g. me) reproduce the process of getting RAI up to speed?

Yes, I will provide the Dockerfile first thing tomorrow and possibly host the built image later on.

@maciejmajek
Copy link
Member

Using the Humble Docker image from #377, I was able to execute the following:

# /rai
poetry shell
git clone lerobot
cd lerobot
pip install -e .
pytest # Run lerobot tests
cd ../
pytest tests # Run rai tests

Although the pip install -e . command caused some package conflicts, the tests for lerobot succeeded, while the rai tests failed. However, the current error in the rai tests should not cause any issues with using the framework.

Test results for lerobot:

============================== 161 passed, 150 skipped, 5 warnings in 165.17s (0:02:45) ==============================

Test results for rai:

=============== 1 failed, 29 passed, 1 skipped, 6 deselected, 1 xpassed, 2 warnings, 1 error in 13.65s ===============

@maciejmajek
Copy link
Member

Hi @vmayoral, we have made some progress with docker setup. We tested it a bit and it seems promising. #376

Also, fyi @boczekbartek tried running RAI solely on Conda, but due to conda's nature it turned out to be impossible :(

@boczekbartek
Copy link
Member Author

boczekbartek commented Jan 21, 2025

That's true, I tried Conda setup and failed. The problem seem to lay in the conda~ros2 conflict. Here's what I did:

  1. Created fresh conda env: conda create -y -n my_env python=3.12; conda activate my_env
  2. Installed lerobot with pip install -e .
  3. With some modifications to pyproject.toml I managed to install rai python dependencies with pip install -e . (it's not fully finished yet, I need to work on it more, but basically adaptation to PEP621. I plan to add it anyway in a PR soon)
  4. managed to build rai ros2 packages with colcon. It's important to do conda deactivate before colcon build --symlink-install, to avoid the em error.
  5. Failed to run any python code that requires rclpy. It fails on import rclpy , because of some libraries conflict. I consistently get this error:
Python 3.12.8 | packaged by Anaconda, Inc. | (main, Dec 11 2024, 16:31:09) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rclpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/ros/jazzy/lib/python3.12/site-packages/rclpy/__init__.py", line 49, in <module>
    from rclpy.signals import install_signal_handlers
  File "/opt/ros/jazzy/lib/python3.12/site-packages/rclpy/signals.py", line 15, in <module>
    from rclpy.exceptions import InvalidHandle
  File "/opt/ros/jazzy/lib/python3.12/site-packages/rclpy/exceptions.py", line 16, in <module>
    from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy
  File "/opt/ros/jazzy/lib/python3.12/site-packages/rclpy/impl/implementation_singleton.py", line 32, in <module>
    rclpy_implementation = import_c_library('._rclpy_pybind11', package)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/jazzy/lib/python3.12/site-packages/rpyutils/import_c_library.py", line 39, in import_c_library
    return importlib.import_module(name, package=package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bboczek/anaconda3/envs/lerobot4/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: /home/bboczek/anaconda3/envs/lerobot4/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /opt/ros/jazzy/lib/python3.12/site-packages/rclpy/_rclpy_pybind11.cpython-312-x86_64-linux-gnu.so)
The C extension '/opt/ros/jazzy/lib/python3.12/site-packages/rclpy/_rclpy_pybind11.cpython-312-x86_64-linux-gnu.so' failed to be imported while being present on the system. Please refer to 'https://docs.ros.org/en/jazzy/How-To-Guides/Installation-Troubleshooting.html#import-failing-even-with-library-present-on-the-system' for possible solutions

For point 5:

  • I tried different orders of sourcing: conda and ros2 (conda activate my_env, . ./install/setup.bash)
  • even tried different order of paths (conda_path:ros2_paths or ros2_paths:conda_paths) in $PATH and $LD_LIBRARY_PATH

I'm afraid to integrate lerobot with rai, conda is not a good fit, because of ros2. I would recommend getting inspired by docs and dockerfile, installing rai locally with poetry and following what @maciejmajek posted in his comment .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants