ImportError: dynamic module does not define module export function (PyInit__tf2)

Greetings,

I am using ROS Melodic, which I then added Python 3 packages to it.

I tried the solutions that were suggested throughout the internet, which involves downloading the geometry package into my workspace and then using catkin_make_isolated and catkin_build, but it gave me more errors instead. I did not attempt to use a python 3 virtual environment because I want to be able to use Python 3 as the main environment in my ROS melodic, which is why I set my ROS_PYTHON_VERSION from 2 to 3 beforehand.

Below is a description of my progress to solve the error, as mentioned in the title:


Before I used the catkin_build command, i used catkin_make_isolated instead, without flags, and it resulted in the following errors:

/opt/ros/melodic/lib/rviz/rviz: symbol lookup error: /opt/ros/melodic/lib/libtf.so: undefined symbol: _ZN7tf2_ros17TransformListenerC1ERN3tf210BufferCoreERKN3ros10NodeHandleEb

Traceback (most recent call last):
File “/home/mwh/catkin_test/src/team_meap_atc/autodock/autodock_core/scripts/simple_autodock.py”, line 25, in
from autodock_core.autodock_utils import DockState
File “/home/mwh/catkin_test/src/team_meap_atc/autodock/autodock_core/scripts/autodock_core/autodock_utils.py”, line 27, in
from autodock_core.msg import AutoDockingFeedback
ModuleNotFoundError: No module named ‘autodock_core.msg’

This is also ROS in my laptop somehow not able to access the necessary message files, despite echo $PYTHONPATH saying that the path to the directory exists.

I then proceeded to redo using the following commands:

mkdir -p ~/catkin_ws/src; cd ~/catkin_ws
catkin_make
source devel/setup.bash
wstool init
wstool set -y src/geometry2 --git GitHub - ros/geometry2: A set of ROS packages for keeping track of coordinate transforms. -v 0.7.6
wstool update src/geometry2
rosdep install --from-paths src --ignore-src -y -r
catkin build --cmake-args \ -DCMAKE_BUILD_TYPE=Release \ -DPYTHON_EXECUTABLE=/usr/bin/python3 \ -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m \ -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so

After I run the commands above, I then got an error claiming: Errors << catkin_tools_prebuild:cmake /home/mwh/catkin_test/logs/catkin_tools_prebuild/build.cmake.000.log
CMake Error: The source directory “/home/mwh/catkin_test/build/catkin_tools_prebuild/ -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so” does not exist.

But when I checked my computer files, the directories exist.

This topic was automatically closed after 7 days. New replies are no longer allowed.