tomas789 / kitti2bag

Convert KITTI dataset to ROS bag file the easy way!
MIT License
702 stars 256 forks source link

No module named '_tf2' #15

Closed richardzyx closed 5 years ago

richardzyx commented 6 years ago

I'm running this package on Ubuntu 16.04 with python aliased to python3, I ran into this exception message:

Traceback (most recent call last):
  File "/usr/local/bin/kitti2bag", line 12, in <module>
    import tf
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf/__init__.py", line 28, in <module>
    from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/__init__.py", line 37, in <module>
    from tf2_py import *
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_py/__init__.py", line 37, in <module>
    from _tf2 import *
ImportError: No module named '_tf2'

Is there some dependencies I'm missing? It seems to be related to this issue: https://github.com/ros/geometry2/issues/259 but I'm not sure. I've followed the tutorial on tf to install the packages.

Thanks!

breyner-posso commented 6 years ago

Hi, I got the same error:

Traceback (most recent call last): File "/usr/local/bin/kitti2bag", line 12, in import tf File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf/init.py", line 28, in from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/init.py", line 38, in from tf2_py import File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_py/init.py", line 38, in from ._tf2 import ImportError: dynamic module does not define module export function (PyInit__tf2)

Did you solve this problem?

Tks a lot!

tomas789 commented 6 years ago

Hi @breyner-posso,

Can you check your environment? This error is almost certainly connected to your Python. Can you try running following command and sharing outputs?

python -c "import tf"

python2.7 -c "import tf"

It will show if you can correctly import tf library. Similar error can also happen if you run it in virtualenv.

theplaystar commented 6 years ago

I have the same problem with


python2.7 -c "import tf" Cannot load geometry_msgs moduleTraceback (most recent call last): File "", line 1, in File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf/init.py", line 28, in from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/init.py", line 38, in from tf2_py import File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_py/init.py", line 38, in from ._tf2 import File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/init.py", line 47, in from std_msgs.msg import Header File "/opt/ros/kinetic/lib/python2.7/dist-packages/std_msgs/msg/init.py", line 1, in from ._Bool import * File "/opt/ros/kinetic/lib/python2.7/dist-packages/std_msgs/msg/_Bool.py", line 5, in import genpy File "/opt/ros/kinetic/lib/python2.7/dist-packages/genpy/init.py", line 34, in from . message import Message, SerializationError, DeserializationError, MessageException, struct_I File "/opt/ros/kinetic/lib/python2.7/dist-packages/genpy/message.py", line 40, in import math ImportError: No module named math


python -c "import tf" Traceback (most recent call last): File "", line 1, in File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf/init.py", line 28, in from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/init.py", line 38, in from tf2_py import File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_py/init.py", line 38, in from ._tf2 import ImportError: dynamic module does not define module export function (PyInit__tf2)


That means I should reinstall my OS?

tomas789 commented 6 years ago

@theplaystar According to your output, there is clearly problem with how your ROS setup, not kitti2bag. Problem is that your python does not see some parts of ROS. Can you double check that you correctly run source /opt/ros/... as recommended by ROS install guide?

Since this issue is not caused by kitti2bag, I would recommend consulting ROS Answers or similar place.

GaoJunqiang commented 6 years ago

sudo pip2 install kitti2bag python2 kitti2bag -t 2011_09_29 -r 0071 raw_synced . and bingo!

kplmcelligott commented 5 years ago

I got it working using the following comands in ros-kinetic:

sudo python -m pip install --upgrade pip sudo pip install kitti2bag sudo apt-get update sudo apt-get upgrade