Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: dynamic module does not define module export function (PyInit__tf2) After compilation #501

Open
yanjunyangmonash opened this issue Mar 8, 2021 · 2 comments

Comments

@yanjunyangmonash
Copy link

Hi, I'm using Ubuntu 18.04 and ROS melodic. I first got this error when I tried to import tf2_ros, and I followed this instruction to install the tf2_ros. Since the other packages have to be compiled using catkin build, I made some modifications. Below are commands I used to compile it for python3

cd ~/catkin_ws
source devel/setup.bash
wstool init
wstool set -y src/geometry2 --git https://github.com/ros/geometry2 -v melodic-devel
wstool up
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

source devel/setup.bash

After doing these, when I imported tf2_ros, I still get the same error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/yanjun/catkin_ws/src/geometry2/tf2_ros/src/tf2_ros/__init__.py", line 38, in <module>
    from tf2_py import *
  File "/home/yanjun/catkin_ws/src/geometry2/tf2_py/src/tf2_py/__init__.py", line 38, in <module>
    from ._tf2 import *
ModuleNotFoundError: No module named 'tf2_py._tf2'
@yellow07200
Copy link

I have the exactly same issue. Have you solved this problem?

@yanjunyangmonash
Copy link
Author

I have the exactly same issue. Have you solved this problem?

From my note

  1. I created a conda virtual env in python 2.7
  2. git clone https://github.com/ros/geometry2.git - b melodic-devel
  3. catkin build

And it worked for me, but I'm not sure if this could help you or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants