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

crazyflie-interfaces build issue and Empy 4.0.0 incompatible #553

Closed
knmcguire opened this issue Aug 9, 2024 · 13 comments
Closed

crazyflie-interfaces build issue and Empy 4.0.0 incompatible #553

knmcguire opened this issue Aug 9, 2024 · 13 comments
Labels
bug Something isn't working

Comments

@knmcguire
Copy link
Collaborator

knmcguire commented Aug 9, 2024

I've just did a fresh install of crazyswarm2 on my 24.04 so I'll make an issue of those that are still current.

When installing, usually empy needs to be installed as well with pip3 install empy lark catkin-pkg which is currently missing from our documentation. This is necessary for building the crazyflie_interfaces (rosidl).

However, there is currently an incompatibility with Empy 4.0.0 which causes these two errors:

...
    File "/opt/ros/jazzy/lib/python3.12/site-packages/rosidl_adapter/resource/__init__.py", line 51, in evaluate_template
      em.BUFFERED_OPT: True,
      ^^^^^^^^^^^^^^^

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

...

    File "/opt/ros/jazzy/lib/python3.12/site-packages/rosidl_adapter/resource/__init__.py", line 69, in evaluate_template
      _interpreter.shutdown()
      ^^^^^^^^^^^^^^^^^^^^^

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

solution

This is due to this error: ros2/rosidl#779

Downgrade empy to:

pip3 install empy==3.3.4
@knmcguire knmcguire added the bug Something isn't working label Aug 9, 2024
@knmcguire knmcguire changed the title Empy 4.0.0 incompatible crazyflie-interfaces build issue and Empy 4.0.0 incompatible Aug 9, 2024
@suojinhui
Copy link

But I am using python 3.12, which is not compatible with empy==3.3.4

@knmcguire
Copy link
Collaborator Author

knmcguire commented Nov 18, 2024

aii... that's not awesome. And unfortunately no bug fix in sight at the original issue at rosidl.

But what do you mean with incompatible? I could install this pip package for 3.12. What kind of error messages are you getting?

@suojinhui
Copy link

I found that I made a mistake in the conda environment and the local environment. You are right. I have installed a lower version of empy and solved the problem.

@knmcguire
Copy link
Collaborator Author

Ah good to know! We should try it for different versions of python anyway in the CI but it's always good to double check.

@rdlynx19
Copy link

rdlynx19 commented Feb 4, 2025

Hi @knmcguire
I'm trying to setup crazyswarm2 on my system running Ubuntu 24.04 and ROS2 Jazzy. I followed the instructions in the docs, but I'm getting a similar error when I run colcon build
Here are the logs:

(crazyflie-clients-python) redhairedlynx@tokyo:~/crazyflie_ws$ colcon build --cmake-args -DC_BUILD_TYPE=Release                                                        
Starting >>> crazyflie_interfaces                                                                                                                                      
--- stderr: crazyflie_interfaces                                                                                                                                       
CMake Error at /opt/ros/jazzy/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:57 (message):                                                                   
                                                                                                                                                                       
  execute_process(/home/redhairedlynx/gitClones/crazyflie-clients-python/bin/python3                                                                                   
  -m rosidl_adapter --package-name crazyflie_interfaces --arguments-file                                                                                               
  /home/redhairedlynx/crazyflie_ws/build/crazyflie_interfaces/rosidl_adapter__arguments__crazyflie_interfaces.json                                                                                                                                                    
  --output-dir                                                                                                                                                         
  /home/redhairedlynx/crazyflie_ws/build/crazyflie_interfaces/rosidl_adapter/crazyflie_interfaces                                                                                                                                                                     
  --output-file                                                  
  /home/redhairedlynx/crazyflie_ws/build/crazyflie_interfaces/rosidl_adapter/crazyflie_interfaces.idls)                                                                                                                                                               
  returned error code 1:                                         
                                         
  AttributeError processing template 'msg.idl.em'                                                                                  
                                                                                   
  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/jazzy/lib/python3.12/site-packages/rosidl_adapter/__main__.py", line 19, in <module>
      sys.exit(main())              
               ^^^^^^               
    File "/opt/ros/jazzy/lib/python3.12/site-packages/rosidl_adapter/main.py", line 53, in main              
      abs_idl_file = convert_to_idl(
                     ^^^^^^^^^^^^^^^
    File "/opt/ros/jazzy/lib/python3.12/site-packages/rosidl_adapter/__init__.py", line 19, in convert_to_idl        
      return convert_msg_to_idl(                                                   
             ^^^^^^^^^^^^^^^^^^^                                                                                                                                       
    File "/opt/ros/jazzy/lib/python3.12/site-packages/rosidl_adapter/msg/__init__.py", line 39, in convert_msg_to_idl                                                                                                                                                 
      expand_template('msg.idl.em', data, output_file, encoding='iso-8859-1')
    File "/opt/ros/jazzy/lib/python3.12/site-packages/rosidl_adapter/resource/__init__.py", line 29, in expand_template  
      content = evaluate_template(template_name, data)                                                                             
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                             
    File "/opt/ros/jazzy/lib/python3.12/site-packages/rosidl_adapter/resource/__init__.py", line 65, in evaluate_template                                                                                                                                             
      _interpreter = em.Interpreter(                                               
                     ^^^^^^^^^^^^^^                              
                                                   
  AttributeError: module 'em' has no attribute 'Interpreter'                                                                                                                                                
                                                                                                      
Call Stack (most recent call first):                             
  /opt/ros/jazzy/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:132 (rosidl_adapt_interfaces)                                                                                                                                                              
  CMakeLists.txt:20 (rosidl_generate_interfaces)                                                                                   


---                                                              
Failed   <<< crazyflie_interfaces [1.06s, exited with code 1]                                                                      

Summary: 0 packages finished [1.21s]                             
  1 package failed: crazyflie_interfaces                         
  1 package had stderr output: crazyflie_interfaces                                                                                
  4 packages not processed                                

I made sure to change empy to version 3.3.4

If I try to ignore the interfaces package, I get this error:

(crazyflie-clients-python) redhairedlynx@tokyo:~/crazyflie_ws$ colcon build --packages-ignore=crazyflie_interfaces --cmake-args -DC_BUILD_TYPE=Release
Starting >>> crazyflie_py
Starting >>> crazyflie
Starting >>> crazyflie_sim
--- stderr: crazyflie_sim                                                                                    
Traceback (most recent call last):
  File "/opt/ros/jazzy/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 22, in <module>
    from catkin_pkg.package import parse_package_string
ModuleNotFoundError: No module named 'catkin_pkg'
CMake Error at /opt/ros/jazzy/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:95 (message):
  
  execute_process(/home/redhairedlynx/gitClones/crazyflie-clients-python/bin/python3
  /opt/ros/jazzy/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py
  /home/redhairedlynx/crazyflie_ws/src/crazyswarm2/crazyflie_sim/package.xml
  /home/redhairedlynx/crazyflie_ws/build/crazyflie_sim/ament_cmake_core/package.cmake)
  returned error code 1
Call Stack (most recent call first):
  /opt/ros/jazzy/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
  /opt/ros/jazzy/share/ament_cmake_python/cmake/ament_python_install_package.cmake:60 (ament_package_xml)
  /opt/ros/jazzy/share/ament_cmake_python/cmake/ament_python_install_package.cmake:39 (_ament_cmake_python_install_package)
  CMakeLists.txt:9 (ament_python_install_package)


---
Failed   <<< crazyflie_sim [0.53s, exited with code 1]
Aborted  <<< crazyflie_py [0.88s]                                                          
Aborted  <<< crazyflie [0.87s]

Summary: 0 packages finished [1.04s]
  1 package failed: crazyflie_sim
  2 packages aborted: crazyflie crazyflie_py
  2 packages had stderr output: crazyflie crazyflie_sim
  1 package not processed
(crazyflie-clients-python) redhairedlynx@tokyo:~/crazyflie_ws$ 

I am confused about what's going wrong here. Any help will be appreciated! Thanks

@whoenig
Copy link

whoenig commented Feb 4, 2025

Could you share your pip list | grep empy output?

@rdlynx19
Copy link

rdlynx19 commented Feb 5, 2025

~/crazyflie_ws$ pip list | grep empy
empy                                 3.3.4

I created a new virtual environment which fixed the issue. Another important detail might be that I was using the crazyflie-client virtual environment. Are there chances of dependency conflicts because of that?

@knmcguire
Copy link
Collaborator Author

Do you have perhaps different versions of Python on your machine? ROS might be using another one than of which the regular pip acts from.

@rdlynx19
Copy link

rdlynx19 commented Feb 6, 2025

I ran a bunch of commands to check this.

redhairedlynx@tokyo:/usr/bin$ sudo find /usr/bin -type f -executable -iname 'python*'
/usr/bin/python3.12
/usr/bin/python-argcomplete-check-easy-install-script
/usr/bin/python3.12-coverage
/usr/bin/python3-coverage

Only python3.12 is installed on my system

@knmcguire
Copy link
Collaborator Author

Maybe you have the 'em' package also installed.

If you do pip list | grep em, what do you see?

@rdlynx19
Copy link

rdlynx19 commented Feb 9, 2025

Looks like that was the issue. Thank you! @knmcguire

(crazyflie-clients-python) redhairedlynx@tokyo:~/gitClones/crazyflie-clients-python(master)$ pip list | grep em
demo-nodes-py                        0.33.5
em                                   0.4.0
empy                                 3.3.4
logging-demo                         0.33.5
quality-of-service-demo-py           0.33.5

@knmcguire
Copy link
Collaborator Author

Fwew luckily it was an easy fix still. Thanks for being so responsive

@rdlynx19
Copy link

I think we can close the issue. I don't have the permissions to do this.

@whoenig whoenig closed this as completed Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants