google-coral / edgetpu-platforms

EdgeTPU support for other platforms, specifically Raspberry Pi Zero
Apache License 2.0
82 stars 11 forks source link

AttributeError: module 'enum' has no attribute 'IntFlag' #28

Closed Luke1962 closed 3 years ago

Luke1962 commented 4 years ago

Hi, I'm trying to make these libraries working on Rockpi4 (RK3399 Arm Sbc), with installed on:

cd /usr/local/lib/python3.6/dist-packages/edgetpu/swig/
 sudo ln -s _edgetpu_cpp_wrapper.cpython-35m-aarch64-linux-gnu.so _edgetpu_cpp_wrapper.cpython-36m-aarch64-linux-gnu.so

After edgetpu installation, if I run the classic test script:

python3 classify_image.py \
--model ~/coral/test/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \
--label ~/coral/test/inat_bird_labels.txt \
--image ~/coral/test/parrot.jpg

I get the following error:


Traceback (most recent call last):
  File "classify_image.py", line 16, 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 "classify_image.py", line 16, 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'

I've only found on internet, as working solution, to uninstall enum34 with:

sudo apt-get remove python-enum34

Unfortunately, this operation would uninstall a lot of ros packages I need, as reported here below:

rock@rockpi4:~/coral/test$ sudo apt-get remove python-enum34
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  cython default-libmysqlclient-dev fltk1.3-doc fluid freeglut3 freeglut3-dev
  gazebo9 gazebo9-common gazebo9-plugin-base gdal-data google-mock googletest
  hdf5-helpers ibverbs-providers libaec-dev libaec0 libapr1 libapr1-dev
  libaprutil1 libaprutil1-dev libarmadillo-dev libarmadillo8 libarpack2
  libarpack2-dev libassimp-dev libassimp4 libassuan-dev libavdevice-dev
  libavfilter-dev libavresample-dev libblas-dev libboost-all-dev
  libboost-atomic-dev libboost-atomic1.65-dev libboost-atomic1.65.1
  libboost-chrono-dev libboost-chrono1.65-dev libboost-chrono1.65.1
  libboost-container-dev libboost-container1.65-dev libboost-container1.65.1
  libboost-context-dev libboost-context1.65-dev libboost-context1.65.1
  libboost-coroutine-dev libboost-coroutine1.65-dev libboost-coroutine1.65.1
  libboost-date-time-dev libboost-date-time1.65-dev libboost-dev
  libboost-exception-dev libboost-exception1.65-dev libboost-fiber-dev
  libboost-fiber1.65-dev libboost-fiber1.65.1 libboost-filesystem-dev
  libboost-filesystem1.65-dev libboost-graph-dev libboost-graph-parallel-dev
  libboost-graph-parallel1.65-dev libboost-graph-parallel1.65.1
  libboost-graph1.65-dev libboost-graph1.65.1 libboost-iostreams-dev
  libboost-iostreams1.65-dev libboost-locale-dev libboost-locale1.65-dev
  libboost-log-dev libboost-log1.65-dev libboost-log1.65.1 libboost-math-dev
  libboost-math1.65-dev libboost-math1.65.1 libboost-mpi-dev
  libboost-mpi-python-dev libboost-mpi-python1.65-dev
  libboost-mpi-python1.65.1 libboost-mpi1.65-dev libboost-mpi1.65.1
  libboost-numpy-dev libboost-numpy1.65-dev libboost-numpy1.65.1
  libboost-program-options-dev libboost-program-options1.65-dev
  libboost-program-options1.65.1 libboost-python-dev libboost-python1.65-dev
  libboost-python1.65.1 libboost-random-dev libboost-random1.65-dev
  libboost-random1.65.1 libboost-regex-dev libboost-regex1.65-dev
  libboost-regex1.65.1 libboost-serialization-dev
  libboost-serialization1.65-dev libboost-serialization1.65.1
  libboost-signals-dev libboost-signals1.65-dev libboost-signals1.65.1
  libboost-stacktrace-dev libboost-stacktrace1.65-dev
  libboost-stacktrace1.65.1 libboost-system-dev libboost-system1.65-dev
  libboost-test-dev libboost-test1.65-dev libboost-test1.65.1
  libboost-thread-dev libboost-thread1.65-dev libboost-timer-dev
  libboost-timer1.65-dev libboost-timer1.65.1 libboost-tools-dev
  libboost-type-erasure-dev libboost-type-erasure1.65-dev
  libboost-type-erasure1.65.1 libboost-wave-dev libboost-wave1.65-dev
  libboost-wave1.65.1 libboost1.65-dev libboost1.65-tools-dev libbullet-dev
  libbullet2.87 libccd-dev libccd2 libcharls1 libconsole-bridge-dev
  libconsole-bridge0.4 libcurl4-openssl-dev libdap-dev libdap25
  libdapclient6v5 libdapserver7v5 libeigen3-dev libepsilon-dev libepsilon1
  libexif-dev libexif-doc libflann-dev libflann1.9 libfltk-cairo1.3
  libfltk-forms1.3 libfltk-gl1.3 libfltk-images1.3 libfltk1.3 libfltk1.3-dev
  libfreeimage-dev libfreeimage3 libfreexl-dev libfreexl1 libfyba-dev libfyba0
  libgazebo9 libgazebo9-dev libgdal-dev libgdal20 libgdcm2-dev libgdcm2.8
  libgeos-3.6.2 libgeos-c1v5 libgeos-dev libgeotiff-dev libgeotiff2 libgif-dev
  libgif7 libgl2ps-dev libgl2ps1.4 libgpg-error-dev libgpgme-dev
  libgphoto2-dev libgraphviz-dev libgtest-dev libgts-dev libgvc6-plugins-gtk
  libhdf4-0-alt libhdf4-alt-dev libhdf5-100 libhdf5-cpp-100 libhdf5-dev
  libhdf5-mpi-dev libhdf5-openmpi-100 libhdf5-openmpi-dev libhwloc-dev
  libhwloc-plugins libhwloc5 libibverbs-dev libibverbs1 libignition-cmake-dev
  libignition-common libignition-common-dev libignition-fuel-tools1-1
  libignition-fuel-tools1-dev libignition-math4 libignition-math4-dev
  libignition-msgs libignition-msgs-dev libignition-transport4
  libignition-transport4-dev libilmbase-dev libjs-jquery-ui libjs-sphinxdoc
  libjs-underscore libjson-c-dev libjsoncpp-dev libjxr0 libkml-dev libkmlbase1
  libkmlconvenience1 libkmldom1 libkmlengine1 libkmlregionator1 libkmlxsd1
  liblapack-dev libldap2-dev liblept5 liblog4cxx-dev liblog4cxx10v5 liblz4-dev
  libminizip-dev libminizip1 libmysqlclient-dev libnetcdf-c++4
  libnetcdf-cxx-legacy-dev libnetcdf-dev libnetcdf13 libnl-route-3-200
  libodbc1 libogdi3.2 libogdi3.2-dev libogre-1.9-dev libogre-1.9.0v5
  libopenal-dev libopencv-calib3d-dev libopencv-calib3d3.2
  libopencv-contrib-dev libopencv-contrib3.2 libopencv-core-dev
  libopencv-core3.2 libopencv-dev libopencv-features2d-dev
  libopencv-features2d3.2 libopencv-flann-dev libopencv-flann3.2
  libopencv-highgui-dev libopencv-highgui3.2 libopencv-imgcodecs-dev
  libopencv-imgcodecs3.2 libopencv-imgproc-dev libopencv-imgproc3.2
  libopencv-ml-dev libopencv-ml3.2 libopencv-objdetect-dev
  libopencv-objdetect3.2 libopencv-photo-dev libopencv-photo3.2
  libopencv-shape-dev libopencv-shape3.2 libopencv-stitching-dev
  libopencv-stitching3.2 libopencv-superres-dev libopencv-superres3.2
  libopencv-ts-dev libopencv-video-dev libopencv-video3.2
  libopencv-videoio-dev libopencv-videoio3.2 libopencv-videostab-dev
  libopencv-videostab3.2 libopencv-viz-dev libopencv-viz3.2 libopencv3.2-java
  libopencv3.2-jni libopenexr-dev libopenjp2-7-dev libopenmpi-dev libopenmpi2
  libopenni-dev libopenni-sensor-pointclouds0 libopenni0 libopenni2-0
  libopenni2-dev libpcl-apps1.8 libpcl-common1.8 libpcl-features1.8
  libpcl-filters1.8 libpcl-io1.8 libpcl-kdtree1.8 libpcl-keypoints1.8
  libpcl-ml1.8 libpcl-octree1.8 libpcl-outofcore1.8 libpcl-people1.8
  libpcl-recognition1.8 libpcl-registration1.8 libpcl-sample-consensus1.8
  libpcl-search1.8 libpcl-segmentation1.8 libpcl-stereo1.8 libpcl-surface1.8
  libpcl-tracking1.8 libpcl-visualization1.8 libpoco-dev libpococrypto50
  libpocodata50 libpocodatamysql50 libpocodataodbc50 libpocodatasqlite50
  libpocofoundation50 libpocojson50 libpocomongodb50 libpoconet50
  libpoconetssl50 libpocoredis50 libpocoutil50 libpocoxml50 libpocozip50
  libpoppler-dev libpoppler-private-dev libpostproc-dev libpq-dev libpq5
  libproj-dev libproj12 libprotoc-dev libprotoc10 libqhull-dev libqhull-r7
  libqhull7 libqt5concurrent5 libqt5designer5 libqt5designercomponents5
  libqt5help5 libqt5opengl5-dev libqt5quickparticles5 libqt5quicktest5
  libqt5quickwidgets5 libqt5sql5 libqt5sql5-sqlite libqt5test5
  libqt5webkit5-dev libqt5xml5 libqtpropertybrowser4 libqwt-headers
  libqwt-qt5-6 libqwt-qt5-dev libsctp-dev libsctp1 libsdformat6
  libsdformat6-dev libsimbody-dev libsimbody3.5v5 libsocket++1
  libspatialite-dev libspatialite7 libspnav0 libsqlite3-dev libsuperlu-dev
  libsuperlu5 libsz2 libtar-dev libtar0 libtesseract4 libtheora-dev
  libtinyxml-dev libtinyxml2-6 libtinyxml2-dev libtinyxml2.6.2v5
  liburdfdom-dev liburdfdom-headers-dev liburdfdom-model
  liburdfdom-model-state liburdfdom-sensor liburdfdom-world liburiparser-dev
  liburiparser1 libusb-1.0-0-dev libusb-1.0-doc libvtk6-java libvtk6-jni
  libvtk6.3 libvtk6.3-qt libwebp-dev libwxbase3.0-0v5 libwxgtk3.0-gtk3-0v5
  libxdot4 libxerces-c-dev libxerces-c3.2 libxml2-dev libxmu-dev
  libxmu-headers libyaml-cpp-dev libyaml-cpp0.5v5 libyaml-dev libzip-dev
  libzmq3-dev libzzip-0-13 mpi-default-bin mpi-default-dev odbcinst
  odbcinst1debian2 opencv-data openmpi-bin openmpi-common openni-utils
  proj-bin proj-data protobuf-compiler pyqt5-dev python-asn1crypto python-attr
  python-automat python-backports.functools-lru-cache python-bs4 python-cairo
  python-catkin-pkg python-cbor python-cffi-backend python-click
  python-colorama python-concurrent.futures python-constantly python-cycler
  python-defusedxml python-empy python-gnupg python-html5lib python-hyperlink
  python-idna python-incremental python-ipaddress python-lxml python-lz4
  python-matplotlib python-matplotlib-data python-mpi4py python-nacl
  python-netifaces python-opencv python-opengl python-pam python-psutil
  python-pyasn1 python-pyasn1-modules python-pydot python-pyqt5
  python-pyqt5.qtopengl python-pyqt5.qtsvg python-pyqt5.qtwebkit python-qrcode
  python-rosdep python-rosdep-modules python-rosdistro
  python-rosdistro-modules python-serial python-sip python-sip-dev
  python-snappy python-subprocess32 python-trie python-trollius
  python-twisted-bin python-u-msgpack python-ubjson python-webencodings
  python-wsaccel python-wxgtk3.0 python-wxtools python-wxversion
  python-zope.interface qt5-assistant qt5-qmake qt5-qmake-bin qtbase5-dev
  qtbase5-dev-tools qtdeclarative5-dev qttools5-dev qttools5-dev-tools
  qttools5-private-dev ros-melodic-actionlib-msgs ros-melodic-angles
  ros-melodic-bond ros-melodic-bond-core ros-melodic-bondcpp
  ros-melodic-bondpy ros-melodic-camera-calibration
  ros-melodic-camera-calibration-parsers ros-melodic-camera-info-manager
  ros-melodic-catkin ros-melodic-class-loader ros-melodic-cmake-modules
  ros-melodic-common-msgs ros-melodic-compressed-depth-image-transport
  ros-melodic-compressed-image-transport ros-melodic-control-msgs
  ros-melodic-controller-interface ros-melodic-controller-manager
  ros-melodic-controller-manager-msgs ros-melodic-cpp-common
  ros-melodic-cv-bridge ros-melodic-diagnostic-aggregator
  ros-melodic-diagnostic-analysis ros-melodic-diagnostic-msgs
  ros-melodic-diagnostic-updater ros-melodic-dynamic-reconfigure
  ros-melodic-eigen-conversions ros-melodic-filters ros-melodic-gazebo-dev
  ros-melodic-gazebo-msgs ros-melodic-gencpp ros-melodic-geneus
  ros-melodic-genlisp ros-melodic-genmsg ros-melodic-gennodejs
  ros-melodic-genpy ros-melodic-geometry-msgs ros-melodic-gl-dependency
  ros-melodic-hardware-interface ros-melodic-image-common
  ros-melodic-image-geometry ros-melodic-image-proc
  ros-melodic-image-publisher ros-melodic-image-transport
  ros-melodic-image-transport-plugins ros-melodic-image-view
  ros-melodic-joint-limits-interface ros-melodic-joint-state-publisher
  ros-melodic-kdl-conversions ros-melodic-kdl-parser ros-melodic-kdl-parser-py
  ros-melodic-map-msgs ros-melodic-media-export ros-melodic-message-filters
  ros-melodic-message-generation ros-melodic-message-runtime ros-melodic-mk
  ros-melodic-nav-msgs ros-melodic-nodelet ros-melodic-nodelet-core
  ros-melodic-nodelet-topic-tools ros-melodic-nodelet-tutorial-math
  ros-melodic-orocos-kdl ros-melodic-pcl-msgs ros-melodic-pluginlib
  ros-melodic-pluginlib-tutorials ros-melodic-polled-camera
  ros-melodic-python-orocos-kdl ros-melodic-python-qt-binding
  ros-melodic-qt-dotgraph ros-melodic-qt-gui ros-melodic-qt-gui-cpp
  ros-melodic-qt-gui-py-common ros-melodic-qwt-dependency
  ros-melodic-resource-retriever ros-melodic-ros ros-melodic-ros-environment
  ros-melodic-ros-tutorials ros-melodic-rosbag
  ros-melodic-rosbag-migration-rule ros-melodic-rosbag-storage
  ros-melodic-rosbash ros-melodic-rosboost-cfg ros-melodic-rosbuild
  ros-melodic-rosclean ros-melodic-rosconsole ros-melodic-rosconsole-bridge
  ros-melodic-roscpp ros-melodic-roscpp-core ros-melodic-roscpp-serialization
  ros-melodic-roscpp-traits ros-melodic-roscpp-tutorials ros-melodic-roscreate
  ros-melodic-rosgraph ros-melodic-rosgraph-msgs ros-melodic-roslang
  ros-melodic-roslib ros-melodic-roslint ros-melodic-roslisp
  ros-melodic-roslz4 ros-melodic-rosmake ros-melodic-rosmaster
  ros-melodic-rosmsg ros-melodic-rosnode ros-melodic-rosout
  ros-melodic-rospack ros-melodic-rosparam ros-melodic-rospy
  ros-melodic-rospy-tutorials ros-melodic-rosservice ros-melodic-rostime
  ros-melodic-rostopic ros-melodic-rosunit ros-melodic-rqt-bag
  ros-melodic-rqt-dep ros-melodic-rqt-graph ros-melodic-rqt-gui
  ros-melodic-rqt-gui-cpp ros-melodic-rqt-gui-py ros-melodic-rqt-image-view
  ros-melodic-rqt-logger-level ros-melodic-rqt-py-console
  ros-melodic-rqt-robot-steering ros-melodic-rqt-runtime-monitor
  ros-melodic-rqt-shell ros-melodic-rqt-top ros-melodic-rqt-topic
  ros-melodic-rqt-web ros-melodic-self-test ros-melodic-sensor-msgs
  ros-melodic-shape-msgs ros-melodic-smach ros-melodic-smach-msgs
  ros-melodic-smclib ros-melodic-stage ros-melodic-std-msgs
  ros-melodic-std-srvs ros-melodic-stereo-image-proc ros-melodic-stereo-msgs
  ros-melodic-tf2 ros-melodic-tf2-eigen ros-melodic-tf2-msgs
  ros-melodic-tf2-py ros-melodic-theora-image-transport
  ros-melodic-topic-tools ros-melodic-trajectory-msgs
  ros-melodic-transmission-interface ros-melodic-turtlesim ros-melodic-urdf
  ros-melodic-urdf-parser-plugin ros-melodic-urdfdom-py
  ros-melodic-vision-opencv ros-melodic-visualization-marker-tutorials
  ros-melodic-visualization-msgs ros-melodic-webkit-dependency
  ros-melodic-xmlrpcpp sbcl sdformat-sdf sip-dev tcl-dev tcl-vtk6 tcl8.6-dev
  tk-dev tk8.6-dev ttf-dejavu-core unixodbc-dev vtk6
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  libpcl-dev libvtk6-dev libvtk6-qt-dev python-autobahn python-cryptography
  python-enum34 python-keyring python-openssl python-paramiko
  python-secretstorage python-service-identity python-twisted
  python-twisted-core python-txaio python-vtk6 ros-melodic-actionlib
  ros-melodic-actionlib-tutorials ros-melodic-common-tutorials
  ros-melodic-control-toolbox ros-melodic-depth-image-proc ros-melodic-desktop
  ros-melodic-desktop-full ros-melodic-diagnostic-common-diagnostics
  ros-melodic-diagnostics ros-melodic-diff-drive-controller
  ros-melodic-executive-smach ros-melodic-forward-command-controller
  ros-melodic-gazebo-plugins ros-melodic-gazebo-ros
  ros-melodic-gazebo-ros-control ros-melodic-gazebo-ros-pkgs
  ros-melodic-geometry ros-melodic-geometry-tutorials
  ros-melodic-image-pipeline ros-melodic-image-rotate
  ros-melodic-interactive-marker-tutorials ros-melodic-interactive-markers
  ros-melodic-joint-state-controller ros-melodic-laser-assembler
  ros-melodic-laser-filters ros-melodic-laser-geometry
  ros-melodic-laser-pipeline ros-melodic-librviz-tutorial
  ros-melodic-pcl-conversions ros-melodic-pcl-ros ros-melodic-perception
  ros-melodic-perception-pcl ros-melodic-position-controllers
  ros-melodic-realtime-tools ros-melodic-robot
  ros-melodic-robot-state-publisher ros-melodic-ros-base ros-melodic-ros-comm
  ros-melodic-ros-core ros-melodic-roslaunch ros-melodic-rostest
  ros-melodic-roswtf ros-melodic-rqt-action ros-melodic-rqt-bag-plugins
  ros-melodic-rqt-common-plugins ros-melodic-rqt-console
  ros-melodic-rqt-launch ros-melodic-rqt-moveit ros-melodic-rqt-msg
  ros-melodic-rqt-nav-view ros-melodic-rqt-plot ros-melodic-rqt-pose-view
  ros-melodic-rqt-publisher ros-melodic-rqt-py-common
  ros-melodic-rqt-reconfigure ros-melodic-rqt-robot-dashboard
  ros-melodic-rqt-robot-monitor ros-melodic-rqt-robot-plugins
  ros-melodic-rqt-rviz ros-melodic-rqt-service-caller ros-melodic-rqt-srv
  ros-melodic-rqt-tf-tree ros-melodic-rviz ros-melodic-rviz-plugin-tutorials
  ros-melodic-rviz-python-tutorial ros-melodic-simulators
  ros-melodic-smach-ros ros-melodic-stage-ros ros-melodic-tf
  ros-melodic-tf-conversions ros-melodic-tf2-geometry-msgs ros-melodic-tf2-kdl
  ros-melodic-tf2-ros ros-melodic-turtle-actionlib ros-melodic-turtle-tf
  ros-melodic-turtle-tf2 ros-melodic-urdf-sim-tutorial
  ros-melodic-urdf-tutorial ros-melodic-visualization-tutorials
  ros-melodic-viz ros-melodic-xacro
0 upgraded, 0 newly installed, 96 to remove and 0 not upgraded.
After this operation, 115 MB disk space will be freed.
Do you want to continue? [Y/n] 

I've also installed this package which sould solve the problem:

pip install enum-compat

but seems not working (same error).

Is there a solution to point explicitly to enum standard library without removing enum34?

sohartma commented 4 years ago

I had the same issue. Wanted to use the system python (2.7), but cmake used python3.6 somehow. I edited the python path in the catkin_find_pkg file, which equals to your argparse.py file. So with python 2 it worked, no error. I guess, check that your python paths are correct. Or go with python2.

manoj7410 commented 3 years ago

Feel free to reopen if this is still an issue.

nagarjunvinukonda commented 1 year ago

I have the same issue:

Any solution?