error when using catkin_make

asked 2019-10-08 14:27:37 -0500

KOMODO gravatar image

I am learning ROS on tutorials page and i created a catkin_ws but for the 2nd time when i used catkin_make command i get this error. I got an error about catkin_make earlier but i found the solve. Now for the * AttributeError: module 'enum' has no attribute 'IntFlag'* i did not find sample error on Net. Anyone knows what is the problem?

komodo@komodo-desktop:~/catkin_ws$ catkin_make
Base path: /home/komodo/catkin_ws
Source space: /home/komodo/catkin_ws/src
Build space: /home/komodo/catkin_ws/build
Devel space: /home/komodo/catkin_ws/devel
Install space: /home/komodo/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/komodo/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/komodo/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/melodic
-- This workspace overlays: /opt/ros/melodic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.8", minimum required is "2") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/komodo/catkin_ws/build/test_results
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.6.8") 
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
Traceback (most recent call last):
  File "/opt/ros/melodic/share/catkin/cmake/parse_package_xml.py", line 38, in <module>
    import argparse
  File "/usr/lib/python3.6/argparse.py", line 89, in <module>
    import re as _re
  File "/usr/lib/python3.6/re.py", line 142, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
    if not enabled():
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 24, in enabled
    import re
  File "/usr/lib/python3.6/re.py", line 142, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

Original exception was:
Traceback (most recent call last):
  File "/opt/ros/melodic/share/catkin/cmake/parse_package_xml.py", line 38, in <module>
    import argparse
  File "/usr/lib/python3.6/argparse.py", line 89, in <module>
    import re as _re
  File "/usr/lib/python3.6/re.py", line 142, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  execute_process(/usr/bin/python3
  "/opt/ros/melodic/share/catkin/cmake/parse_package_xml.py"
  "/opt/ros/melodic/share/catkin/cmake/../package.xml"
  "/home/komodo/catkin_ws/build/catkin/catkin_generated/version/package.cmake")
  returned error code 1
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/catkin_package_xml.cmake:74 (safe_execute_process)
  /opt/ros/melodic/share/catkin/cmake/all.cmake:167 (_catkin_package_xml)
  /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:20 (include)
  CMakeLists.txt:56 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/komodo/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/komodo/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:320: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1


Invoking "make cmake_check_build_system" failed
edit retag flag offensive close merge delete

Comments

1

Looks like you are using a different version of Python than ROS Melodic is based off of. The question is... why is that happening? Are you using something like Anaconda? Have you updated your system in some way to change the default Python?

jarvisschultz gravatar imagejarvisschultz ( 2019-10-08 16:46:34 -0500 )edit

My system is Raspberry Pi 3 B+ booted with Ubuntu Mate 18.04. I installed Melodic version with terminal without doing anyting unordinary. I did not use anadonda.

""

komodo@komodo-desktop:~$ which python
/usr/bin/python
komodo@komodo-desktop:~$ python --version
Python 2.7.15+
komodo@komodo-desktop:~$

""

I am using python version 2.7.15+

komodo@komodo-desktop:~/catkin_ws$ echo $PYTHONPATH
/opt/ros/melodic/lib/python2.7/dist-packages

My python path. Is this the problem?

KOMODO gravatar imageKOMODO ( 2019-10-09 02:23:12 -0500 )edit

That's very weird. Your system is defaulting to the correct version of Python, but somehow CMake picked up the wrong version of Python (BTW, this is not controlled by the PYTHONPATH environment variable). You could try running

catkin_make -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python

to force CMake to use the 2.7 version. Does that help?

jarvisschultz gravatar imagejarvisschultz ( 2019-10-09 10:16:35 -0500 )edit