ImportError: dynamic module does not define module export function (PyInit_PyKDL)
I'm trying to run the code you can see below and after trying to import do_transform_cloud
from tf2_sensor_msgs
i receive an error:
Traceback (most recent call last):
File "/media/wojtek/48ee3ba1-28bb-493d-b2ff-de733667d003/wojtek/Inz/mybot_ws-base_sensors/src/pyros/DMO.py", line 7, in <module>
from tf2_sensor_msgs.tf2_sensor_msgs import do_transform_cloud
File "/opt/ros/melodic/lib/python2.7/dist-packages/tf2_sensor_msgs/tf2_sensor_msgs.py", line 30, in <module>
import PyKDL
ImportError: dynamic module does not define module export function (PyInit_PyKDL)
Ubuntu 18.04 LTS, ROS: Melodic
#! /usr/bin/env python
import rospy
from nav_msgs.msg import Odometry
from sensor_msgs.msg import PointCloud2 as pc2
from sensor_msgs.msg import LaserScan
from laser_geometry import LaserProjection
from tf2_sensor_msgs.tf2_sensor_msgs import do_transform_cloud
#cloud_out = do_transform_cloud(cloud_in, transform)
class Laser2PC():
def __init__(self):
self.laserProj = LaserProjection()
self.pcPub = rospy.Publisher ("/laserPointCloud",pc2, queue_size=1)
self.laserSub = rospy.Subscriber ("/mybot/laser/scan",
LaserScan, self.laserCallback)
def laserCallback(self, data):
cloud_out = self.laserProj.projectLaser(data)
self.pcPub.publish(cloud_out)
def main():
rospy.init_node('listener_extend')
l2pc = Laser2PC()
rospy.spin()
if __name__ == '__main__':
main()
Asked by asbird on 2019-11-18 17:49:38 UTC
Comments
this looks like some kind of virtual or conda environment or some other isolated setup.
Are you using something like that?
Asked by gvdhoorn on 2019-11-19 03:38:52 UTC
This is where is my project folder
/Inz
and this is path to my other partition/media/wojtek/48ee3ba1-28bb-493d-b2ff-de733667d003/wojtek
On my main partition I've got system filesAsked by asbird on 2019-11-19 04:57:11 UTC
@gvdhoorn I'm thinking if maybe version of python could be the problem ?
Asked by asbird on 2019-11-19 05:57:57 UTC
Could be, in that case you'll want to tell us which versions of things you are using.
And the output of
python --version
andwhich python
. And which platform this is (CPU arch), how you installed ROS (and PyKDL), etc.Asked by gvdhoorn on 2019-11-19 07:25:23 UTC
I've uninstalled Anaconda and reinstalled ROS, now everything this is my result of these commands:
Should I change python version for future work ?
Asked by asbird on 2019-11-19 08:21:28 UTC
Now when i change to python 3.6 from
update-alternatives --config python
this error appearsShould i work on python 2.7.6 or there is a way to make it work on 3.6
Asked by asbird on 2019-11-19 08:29:03 UTC
The packages distributed with ROS Melodic are only installed for the system-provided, default Python version. For Ubuntu Bionic, that is still Python
2.7
. Not3.6
.Asked by gvdhoorn on 2019-11-19 09:58:46 UTC