Skip to content

instruction for solving issue with this error : " AttributeError: module 'em' has no attribute 'BUFFERED_OPT' when building firmware for esp32 on udp transfering #232

Open

Description

@AmirSamanMirjalili

Issue template

  • Hardware description: esp32
  • RTOS: freeRtos
  • Installation type: micro_ros_setup
  • Version or commit hash: version of micro-ROS used: galactic for Ubuntu 20.04

Steps to reproduce the issue

Assuming you have already setup the firmware using ros2 run micro_ros_setup create_firmware_ws.sh freertos esp32 and after proper wifi configuration, when you try to build the firmware for udp transferring using ros2 run micro_ros_setup build_firmware.sh you will most likely get an error which related to the Python environment and the em (Empy) module. The specific error is:

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

To resolve this issue, follow these steps:

  1. First, deactivate any active Python virtual environments:
   deactivate

To install empy in the specific Python environment used by the build process, you should use the pip associated with that Python installation. Here's the command to install empy version 3.3.4 in that environment:

~/microros_ws/firmware/toolchain/espressif/python_env/idf4.1_py3.8_env/bin/pip3 install empy==3.3.4
  1. After that, verify the installation:
~/microros_ws/firmware/toolchain/espressif/python_env/idf4.1_py3.8_env/bin/python3 -c "import em; print(em.__file__)"
  1. Update setuptools and wheel:
~/microros_ws/firmware/toolchain/espressif/python_env/idf4.1_py3.8_env/bin/pip3 install --upgrade setuptools wheel
  1. Clean your micro-ROS workspace:
cd ~/microros_ws
rm -rf build install log
  1. Rebuild the workspace:
colcon build --symlink-install
  1. Source the setup file:
source install/local_setup.bash
  1. Try building the firmware again:
ros2 run micro_ros_setup build_firmware.sh

Activity

  1. qq1018408006 commented on Jan 3, 2025

    @qq1018408006

    问题模板

    • 硬件描述:esp32
    • 实时操作系统: freeRtos
    • 安装类型:micro_ros_setup
    • 版本或提交哈希:使用的微型 ROS 版本:Ubuntu 20.04 的 galactic

    重现问题的步骤

    假设您已经使用 设置了固件,ros2 run micro_ros_setup create_firmware_ws.sh freertos esp32并且正确配置了 wifi,当您尝试使用 构建固件以进行 udp 传输时,ros2 run micro_ros_setup build_firmware.sh您很可能会收到与 Python 环境和 em (Empy) 模块相关的错误。具体错误是:

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

    若要解决此问题,请按照下列步骤操作:

    1. 首先,停用所有活动的 Python 虚拟环境:
       deactivate
    

    要在构建过程使用的特定 Python 环境中安装 empy,您应该使用与该 Python 安装关联的 pip。以下是在该环境中安装 empy 版本 3.3.4 的命令:

    ~/microros_ws/firmware/toolchain/espressif/python_env/idf4.1_py3.8_env/bin/pip3 install empy==3.3.4
    
    1. 之后,验证安装:
    ~/microros_ws/firmware/toolchain/espressif/python_env/idf4.1_py3.8_env/bin/python3 -c "import em; print(em.__file__)"
    
    1. 更新 setuptools 和 wheel:
    ~/microros_ws/firmware/toolchain/espressif/python_env/idf4.1_py3.8_env/bin/pip3 install --upgrade setuptools wheel
    
    1. 清理你的微型 ROS 工作区:
    cd ~/microros_ws
    rm -rf build install log
    1. 重建工作区:
    colcon build --symlink-install
    1. 获取安装文件:
    source install/local_setup.bash
    1. 尝试再次构建固件:
    ros2 run micro_ros_setup build_firmware.sh

    It didn't work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions