# ImportError: dynamic module does not define module export function (PyInit\_\_tf2)

**URL:** <https://get-help.theconstruct.ai/t/importerror-dynamic-module-does-not-define-module-export-function-pyinit-tf2/22093>\
**Category:** Open Discussions\
**Created:** [February 2, 2023, 9:12am UTC](https://get-help.theconstruct.ai/t/importerror-dynamic-module-does-not-define-module-export-function-pyinit-tf2/22093 "2023-02-02T09:12:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwhROSlearn](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/m/858c86/32.png) [@mwhROSlearn](https://get-help.theconstruct.ai/u/mwhROSlearn)\
**Post date:** [February 2, 2023, 9:12am UTC](https://get-help.theconstruct.ai/t/importerror-dynamic-module-does-not-define-module-export-function-pyinit-tf2/22093/1 "2023-02-02T09:12:23Z")

</div>

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. · GitHub](https://github.com/ros/geometry2) -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.

---

<div class="post-metadata">

**Author:** ![system](https://get-help.theconstruct.ai/uploads/default/original/2X/9/9d3ce8305cc0d0d9b6e07d15767a6f245c526f1b.jpeg) [@system](https://get-help.theconstruct.ai/u/system)\
**Post date:** [February 9, 2023, 9:12am UTC](https://get-help.theconstruct.ai/t/importerror-dynamic-module-does-not-define-module-export-function-pyinit-tf2/22093/2 "2023-02-09T09:12:32Z")

</div>

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