When running colcon build in the carla-ros-bridge root directory in wsl-2, python throws ModuleNotFoundError: No module named 'em'
. Specifically, it produces this output:
--- stderr: carla_ros_scenario_runner_types
CMake Error at /opt/ros/foxy/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:60 (message):
execute_process(/home/jakob/miniconda3/bin/python3 -m rosidl_adapter
--package-name carla_ros_scenario_runner_types --arguments-file
/home/jakob/carla-ros-bridge/build/carla_ros_scenario_runner_types/rosidl_adapter__arguments__carla_ros_scenario_runner_types.json
--output-dir
/home/jakob/carla-ros-bridge/build/carla_ros_scenario_runner_types/rosidl_adapter/carla_ros_scenario_runner_types
--output-file
/home/jakob/carla-ros-bridge/build/carla_ros_scenario_runner_types/rosidl_adapter/carla_ros_scenario_runner_types.idls)
returned error code 1:
Traceback (most recent call last):
File "/home/jakob/miniconda3/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/jakob/miniconda3/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_adapter/__main__.py", line 19, in <module>
sys.exit(main())
File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_adapter/main.py", line 53, in main
abs_idl_file = convert_to_idl(
File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_adapter/__init__.py", line 18, in convert_to_idl
from rosidl_adapter.msg import convert_msg_to_idl
File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_adapter/msg/__init__.py", line 16, in <module>
from rosidl_adapter.resource import expand_template
File "/opt/ros/foxy/lib/python3.8/site-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/foxy/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:130 (rosidl_adapt_interfaces)
CMakeLists.txt:39 (rosidl_generate_interfaces)
---
I've read elsewhere that this error is caused by the package "empy" missing, so I ran pip3 install empy
and pip install empy
, both produced the output: Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: empy in /home/jakob/.local/lib/python3.8/site-packages (3.3.4)
python -V outputs: Python 2.7.18 python3 -V outputs: Python 3.8.10
I'm running out of ideas to fix this
I tried: -Installing em and running the build again (throws different error message) -reinstalling empy (no changes) -removing the carla-ros-bridge root directory and cloning it again
I found the error. If you take a look at the Traceback, you'll see that Python uses two different paths to two different versions. Specifically /home/jakob/miniconda3/lib/python3.10/
and /opt/ros/foxy/lib/python3.8/site-packages/
. This was due to me building ros foxy in a different miniconda environment than the carla-ros-bridge. The fix was deleting the carla ros bridge and downloading and then building it again in an environment that used python 3.8.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.