- edited description
Problem importing module trac_ik_python in Python 3
Hey,
First of all thank you for making this great tool available!
I am trying to reproduce the example from the readme file in the trac_ik_python package. With Python 2, everything works fine. However, when I try to run this with Python 3, I get the following error:
Traceback (most recent call last):
File "ik.py", line 1, in <module>
from trac_ik_python.trac_ik import IK
File "/.../ros_playground_ws/src/trac_ik_python/src/trac_ik_python/trac_ik.py", line 6, in <module>
from trac_ik_python.trac_ik_wrap import TRAC_IK
File "/.../ros_playground_ws/devel/lib/python2.7/dist-packages/trac_ik_python/trac_ik_wrap.py", line 13, in <module>
from . import _trac_ik_wrap
ImportError: dynamic module does not define module export function (PyInit__trac_ik_wrap)
Does the build configuration for the trac_ik_python package need to be changed to work with Python 3? If yes, how?
I think it would be very useful, if this package could support being used under Python 3, especially since Python 2 will retire in 2020.
Thank you in advance for your help!
P.S.: I am running Ubuntu 18.04 and Python 2.7.15 as well as Python 3.6.8. I cloned trac_ik yesterday from the master branch.
Comments (7)
-
reporter -
Account Deactivated Julian,
the Python API was created and PR’d by a separate author. I have no experience with it. I’d suggest contacting the author directly to see if they will support it. If not, it may eventually get phased out of trac-IK altogether as Python2 gets phased out of Ubuntu.
if you want to take a shot at getting it working, please submit a PR after you verify it works in Python 2 and 3.
-
The current release is built against libpython2.7
To get things going you can try to modify https://bitbucket.org/traclabs/trac_ik/src/master/trac_ik_python/CMakeLists.txt with something like,
# find_package(PythonLibs REQUIRED) find_package(Python3 COMPONENTS Development) include_directories( ${Python3_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ) SWIG_LINK_LIBRARIES(trac_ik_wrap ${Python3_LIBRARIES} ${catkin_LIBRARIES})
-
This is not really needed. Here are instructions to run trac_ik in Python 3: https://bitbucket.org/clemi/trac_ik
-
Hello everyone. I just saw this issue (I don’t get notified if no one mentions me). Feel free to contact me in the future if other issue arise with the Python wrapper.
I’ve just submitted a PR to add support for Python3: https://bitbucket.org/traclabs/trac_ik/pull-requests/26/add-compatibility-with-python3-via-the
-
Account Deactivated - changed status to resolved
Merged PR. Marking this resolved. I no longer work at TRACLabs so future issues and PRs might should send an email to robotics@traclabs.com until a new permanent package maintained steps up.
-
@{557058:eff3a3b0-e19b-43e6-b0a0-22d6a8721c3b} thanks for merging (and sorry to add another commit/PR after finding out I broke the build on Ubuntu 16.04).
Best of luck in your new endeavors! - Log in to comment