TUMcps / human-robot-gym

15 stars 3 forks source link

installation issues with respect to fmt and formatting #6

Closed s0um0r0y closed 2 months ago

s0um0r0y commented 2 months ago

in the setup I was running this line $ python setup.py install

I was facing an issue in the file formatting in fmt/core.h in human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/external/spdlog/include/spdlog/fmt/bundled/core.h how can I fix this formatting issue without changing the functionality of the structure

/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( /home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( running bdist_egg running egg_info writing safety_shield.egg-info/PKG-INFO writing dependency_links to safety_shield.egg-info/dependency_links.txt writing requirements to safety_shield.egg-info/requires.txt writing top-level names to safety_shield.egg-info/top_level.txt reading manifest file 'safety_shield.egg-info/SOURCES.txt' adding license file 'LICENSE' adding license file 'COPYING' writing manifest file 'safety_shield.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_ext Using DCMake type Release -- pybind11 v2.14.0 dev1 -- Build spdlog: 1.14.1 -- Build type: Release -- Configuring done -- Generating done -- Build files have been written to: /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/build [ 10%] Built target long_term_planner [ 16%] Built target spdlog [ 31%] Built target SaRA [ 63%] Built target yaml-cpp [ 67%] Built target yaml-cpp-read [ 67%] Built target yaml-cpp-parse [ 69%] Built target yaml-cpp-sandbox [ 71%] Built target body_part_combined_tests [ 73%] Built target long_term_planner_tests [ 74%] Building CXX object CMakeFiles/safety_shield.dir/src/safety_shield.cc.o [ 76%] Built target roots_tests In file included from /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/external/spdlog/include/spdlog/fmt/fmt.h:24, from /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/external/spdlog/include/spdlog/common.h:50, from /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/external/spdlog/include/spdlog/spdlog.h:12, from /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/include/safety_shield/human_reach.h:25, from /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/include/safety_shield/safety_shield.h:33, from /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/src/safety_shield.cc:1: /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/external/spdlog/include/spdlog/fmt/bundled/core.h: In instantiation of ‘constexpr fmt::v10::detail::value fmt::v10::detail::make_arg(T&) [with bool PACKED = true; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; T = safety_shield::RobotReach::Velocity_method; typename std::enable_if<PACKED, int>::type = 0]’: /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/external/spdlog/include/spdlog/fmt/bundled/core.h:1842:0: required from ‘constexpr fmt::v10::format_arg_store<Context, Args>::format_arg_store(T& ...) [with T = {safety_shield::RobotReach::Velocity_method}; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; Args = {safety_shield::RobotReach::Velocity_method}]’ /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safetyshield/external/spdlog/include/spdlog/logger.h:335:0: required from ‘void spdlog::logger::log(spdlog::source_loc, spdlog::level::level_enum, spdlog::string_view_t, Args&& ...) [with Args = {safety_shield::RobotReach::Velocity_method&}; spdlog::string_view_t = fmt::v10::basic_string_view]’ /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/external/spdlog/include/spdlog/logger.h:80:0: required from ‘void spdlog::logger::log(spdlog::source_loc, spdlog::level::level_enum, fmt::v10::format_string<T ...>, Args&& ...) [with Args = {safety_shield::RobotReach::Velocity_method&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, safety_shield::RobotReach::Velocity_method&>]’ /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/external/spdlog/include/spdlog/logger.h:85:0: required from ‘void spdlog::logger::log(spdlog::level::level_enum, fmt::v10::format_string<T ...>, Args&& ...) [with Args = {safety_shield::RobotReach::Velocity_method&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, safety_shield::RobotReach::Velocity_method&>]’ /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/external/spdlog/include/spdlog/logger.h:140:0: required from ‘void spdlog::logger::info(fmt::v10::format_string<T ...>, Args&& ...) [with Args = {safety_shield::RobotReach::Velocity_method&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, safety_shield::RobotReach::Velocity_method&>]’ /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/external/spdlog/include/spdlog/spdlog.h:168:0: required from ‘void spdlog::info(fmt::v10::format_string<T ...>, Args&& ...) [with Args = {safety_shield::RobotReach::Velocity_method&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, safety_shield::RobotReach::Velocity_method&>]’ /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/src/safety_shield.cc:86:0: required from here /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/external/spdlog/include/spdlog/logger.h:328:0: in ‘constexpr’ expansion of ‘fmt::v10::make_format_args<>(args#0)’ /home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/external/spdlog/include/spdlog/fmt/bundled/core.h:1600: error: ‘fmt::v10::detail::type_is_unformattable_for<safety_shield::RobotReach::Velocitymethod, char> ’ has incomplete type 1600 type_is_unformattable_for<T, typename Context::chartype> ;
/home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/safety_shield/external/spdlog/include/spdlog/fmt/bundled/core.h:1604: error: static assertion failed: Cannot format an argument. To make type T formattable provide a formatter specialization: https://fmt.dev/latest/api.html#udt 1604 formattable,

make[2]: [CMakeFiles/safety_shield.dir/build.make:63: CMakeFiles/safety_shield.dir/src/safety_shield.cc.o] Error 1 make[1]: [CMakeFiles/Makefile2:259: CMakeFiles/safety_shield.dir/all] Error 2 make: * [Makefile:141: all] Error 2 Traceback (most recent call last): File "/home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/setup.py", line 177, in setup( File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/init.py", line 87, in setup return distutils.core.setup(attrs) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup return run_commands(dist) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands dist.run_commands() File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands self.run_command(cmd) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command super().run_command(command) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 987, in run_command cmd_obj.run() File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/command/install.py", line 74, in run self.do_egg_install() File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/command/install.py", line 123, in do_egg_install self.run_command('bdist_egg') File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command self.distribution.run_command(command) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command super().run_command(command) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 987, in run_command cmd_obj.run() File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 165, in run cmd = self.call_command('install_lib', warn_dir=0) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 151, in call_command self.run_command(cmdname) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command self.distribution.run_command(command) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command super().run_command(command) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 987, in run_command cmd_obj.run() File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/command/install_lib.py", line 11, in run self.build() File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/command/install_lib.py", line 112, in build self.run_command('build_ext') File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command self.distribution.run_command(command) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command super().run_command(command) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 987, in run_command cmd_obj.run() File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 84, in run _build_ext.run(self) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run self.build_extensions() File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions _build_ext.build_ext.build_extensions(self) File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 466, in build_extensions self._build_extensions_serial() File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 492, in _build_extensions_serial self.build_extension(ext) File "/home/soumoroy/catkin_ws/src/hrc/human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield/setup.py", line 159, in build_extension subprocess.check_call( File "/home/soumoroy/anaconda3/envs/hrgym/lib/python3.9/subprocess.py", line 373, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', '--build', '.', '-j 8']' returned non-zero exit status 2.

in fmt/core.h line 1576 to 1601

if defined(__cpp_if_constexpr)

// This type is intentionally undefined, only used for errors template <typename T, typename Char> struct type_is_unformattable_for;

endif

template <bool PACKED, typename Context, typename T, FMT_ENABLE_IF(PACKED)> FMT_CONSTEXPR FMT_INLINE auto make_arg(T& val) -> value { using arg_type = remove_cvref_t<decltype(arg_mapper().map(val))>;

constexpr bool formattable_char = !std::is_same<arg_type, unformattable_char>::value; static_assert(formattable_char, "Mixing character types is disallowed.");

// Formatting of arbitrary pointers is disallowed. If you want to format a // pointer cast it to void* or const void*. In particular, this forbids // formatting of [const] volatile char* printed as bool by iostreams. constexpr bool formattable_pointer = !std::is_same<arg_type, unformattable_pointer>::value; static_assert(formattable_pointer, "Formatting of non-void pointers is disallowed.");

constexpr bool formattable = !std::is_same<arg_type, unformattable>::value;

if defined(__cpp_if_constexpr)

if constexpr (!formattable) { type_is_unformattable_for<T, typename Context::chartype> ; }

this block of code seems to have some issues

JakobThumm commented 2 months ago

Hi, I haven't encountered this issue yet. Can you add some steps to reproduce as well, please? On a side note, are you sure you want to add human-robot gym to your catkin ws? If you are only looking for the safety shield for human-robot collaboration and don't need the simulation environment (I assume you are using Gazebo as you are working with ROS), you can also use sara-shield directly.

s0um0r0y commented 2 months ago

Hello, Thanks for the quick reply !

I would like to use the simulation environment and I think installation of human-robot-gym outside the catkin ws is a good idea . I will take that suggestion.

Steps to reproduce:

  1. open terminal and change the directory to the contents of this repo
  2. $ conda activate hrgym
  3. $ cd human-robot-gym/human_robot_gym/controllers/failsafe_controller/sara-shield
  4. $ pip install -r requirements.txt
  5. $ python setup.py install
s0um0r0y commented 2 months ago

ok so following @JakobThumm suggestion I have manged to fix this issue,

Thank you so much.

JakobThumm commented 2 months ago

@s0um0r0y what did you do to fix the issue? This would be valuable for future users.

s0um0r0y commented 2 months ago

I added the human-robot-gym repo outside the catkin_ws and in the environment.yml I put -gym==0.21.0 and -opencv_python==4.6.0.66 this helped me to resolve the issue and run the contents in the repo

s0um0r0y commented 2 months ago

Should I raise a pull request with the above changes ?

JakobThumm commented 2 months ago

We would need to change a lot to be conform with these dependencies. We will include these in a future release.