How to install tf2_geometry_msgs dependency PyKDL?
When importing tf2_geometry_msgs
in a Python script running a node in ROS Noetic
, I keep getting the following error indicating that I need to install PyKDL
.
Traceback (most recent call last):
File "/home/user/catkin_ws/devel/lib/my_package/my_node.py", line 15, in <module>
exec(compile(fh.read(), python_script, 'exec'), context)
File "/home/user/catkin_ws/src/my_package/src/my_node.py", line 6, in <module>
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'
When I try to install PyKDL
using pip3 install PyKDL
, I get the following error:
Collecting PyKDL
Downloading PyKDL-1.4.0.tar.gz (1.5 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rtk9wxen/PyKDL/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rtk9wxen/PyKDL/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-rtk9wxen/PyKDL/pip-egg-info
cwd: /tmp/pip-install-rtk9wxen/PyKDL/
Complete output (7 lines):
running egg_info
creating /tmp/pip-install-rtk9wxen/PyKDL/pip-egg-info/PyKDL.egg-info
writing /tmp/pip-install-rtk9wxen/PyKDL/pip-egg-info/PyKDL.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-install-rtk9wxen/PyKDL/pip-egg-info/PyKDL.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-install-rtk9wxen/PyKDL/pip-egg-info/PyKDL.egg-info/top_level.txt
writing manifest file '/tmp/pip-install-rtk9wxen/PyKDL/pip-egg-info/PyKDL.egg-info/SOURCES.txt'
error: package directory 'PyKDL' does not exist
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
This is frustrating because everything was working great yesterday and I'm unsure what has changed in my ROS
setup. My issue seems to be referenced in the Noetic Migration Guide here but it is not clear to me exactly what I need to do to install the required dependency.
Any ideas?
Asked by Py on 2021-06-12 06:11:51 UTC
Answers
build with the instruction here: https://github.com/orocos/orocos_kinematics_dynamics/blob/release-1.5/python_orocos_kdl/INSTALL.md
And, you'll get a PyKDL.so file here: ./build/devel/lib/python3/dist-packages/PyKDL.so
orocos_kinematics_dynamics/python_orocos_kdl$ find . | egrep "\.so"
./build/devel/lib/python3/dist-packages/PyKDL.so
Then, copy the file to your env's dynamic library path. For example, I'm using conda and python 3.8, I'll do this:
cp ./build/devel/lib/python3/dist-packages/PyKDL.so ~/miniconda3/envs/py3/lib/python3.8/lib-dynload
Then, you can use command below to check whether it works:
python -c "import PyKDL"
Asked by lamuguo on 2022-01-28 12:28:09 UTC
Comments
I am getting "error: static assertion failed: The number of argument annotations does not match the number of function arguments" when doing make
for python_orocos_kdl
Asked by zkytony on 2022-02-08 19:37:17 UTC
Here is a work around.
I found that I could install PyKDL by
sudo apt install python3-pykdl
This installs a library to /usr/lib/python3/dist-packages/PyKDL.cpython-38-x86_64-linux-gnu.so
.
Then, I made sure that my PYTHONPATH
contains /usr/lib/python3/dist-packages/
. Now, import PyKDL
finally succeeds.
Asked by zkytony on 2022-02-08 20:22:35 UTC
Comments
Hello, how to solve this problem after adding 'PyKDL', I tried to update sip, but there is still a version conflict problem.
NODES / shadow_tc_learn_to_pick_ball_qlearn (my_shadow_tc_openai_example/start_qlearning_v2.py)
ROS_MASTER_URI=http://localhost:11311
process[shadow_tc_learn_to_pick_ball_qlearn-1]: started with pid [208521]
Failed to import pyassimp, see https://github.com/ros-planning/moveit/issues/86 for more info
Traceback (most recent call last):
File "/home/ljh0929/ros_robot/tcrobot_ws/src/openai_examples_projects/my_shadow_tc_openai_example/scripts/start_qlearning_v2.py", line 25, in
Asked by liu871795683 on 2022-04-12 04:14:21 UTC
Comments
face same issue, any ideas?
Asked by Dio on 2022-01-27 01:01:02 UTC