geometry2
geometry2 copied to clipboard
Can't import tf2_geometry_msgs
I'm using Ubuntu 18.04 Melodic I can import tf, but not PyKDL I built with
virtualenv -p /usr/bin/python3 venv
source venv/bin/activate
catkin_make --cmake-args
-DPYTHON_EXECUTABLE=/venv/bin/python3.6 \
import PyKDL Traceback (most recent call last): File "
", line 1, in ImportError: dynamic module does not define module export function (PyInit_PyKDL)
I can import PyKDL no problem in the Python2 interpreter
Any solution? Having the same problem..
You need to provide enough information to reproduce your problem. If you're using a virtualenv you need to make sure to compile and install pykdl into your virtualenv. Likely for python2 you're getting the library from the rosdistro or system installation. Whereas it's not compiled for python3 so it won't be available on your PYTHONPATH even if you include the system libraries.
I have the similar problem on Ubuntu 22.04 + Rolling, see https://answers.ros.org/question/344496/cannot-include-tf2_geometry_msgsh/?comment=401865#post-id-401865
Because the workaround is to include /opt/ros/... files in CMakeLists.txt directly, my guess is that the problem is in packaging for the distribution.
Hi,
I'm facing the same error with Noetic. Kindly help, I'm coming up against a deadline and I need this to work:
import tf2_geometry_msgs
File "/opt/ros/noetic/lib/python3/dist-packages/tf2_geometry_msgs/__init__.py", line 1, in <module>
from .tf2_geometry_msgs import *
File "/opt/ros/noetic/lib/python3/dist-packages/tf2_geometry_msgs/tf2_geometry_msgs.py", line 31, in <module>
import PyKDL
ModuleNotFoundError: No module named 'PyKDL'
Hi,
I'm facing the same error with Noetic. Kindly help, I'm coming up against a deadline and I need this to work:
import tf2_geometry_msgs File "/opt/ros/noetic/lib/python3/dist-packages/tf2_geometry_msgs/__init__.py", line 1, in <module> from .tf2_geometry_msgs import * File "/opt/ros/noetic/lib/python3/dist-packages/tf2_geometry_msgs/tf2_geometry_msgs.py", line 31, in <module> import PyKDL ModuleNotFoundError: No module named 'PyKDL'
did you find any solution ast that time?
@Zillaynain since it has been two years, I don't quite remember all the steps I followed to fix it, but from what I remember, I had to create a catkin_isolated_ws, clone this package there and install it using catkin_make_isolated. I think I also followed some steps on their readme to ensure the paths were sourced correctly.