Rosanswers logo

 #!/usr/bin/env python3

import rclyp

from rclyp.node import Node

def main(args = None):
    rclyp.init(args = args)
    node = Node("py_test")
    node.get_logger().info("Hello ROS2")

if __name__ == "__main__":

Hi I am new at ROS2 trying to use this code but my terminal says :

> user@user-VirtualBox:~/ros2_ws/src/my_py_pkg/my_py_pkg$
> ./my_first_node.py  Traceback (most
> recent call last):   File
> "/home/user/ros2_ws/src/my_py_pkg/my_py_pkg/./my_first_node.py", line 3, in <module>
>     import rclyp ModuleNotFoundError: No module named 'rclyp'

I have tried this link but It doesn't look like same error like I got.

Originally posted by fkaan on ROS Answers with karma: 1 on 2022-12-20

Post score: 0


1 Answer 1


Rosanswers logo

The name of the Python client library for ROS 2 is rclpy.

You have:

import rclyp

you'll have to update all references to rclyp and replace them by rclpy.

Originally posted by gvdhoorn with karma: 86574 on 2022-12-20

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by fkaan on 2022-12-20:
sleep is a important think. Thank you a lot


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.