ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

NameError: name 'rclpy' is not defined

asked 2021-03-14 05:23:36 -0600

Ataraxy gravatar image

when i run ros2 run python_parameters param_talker,NameError: name 'rclpy' is not defined hapend. And when i openpython_parameters_node.pyin pycharm, i found No module named 'rclpy'. I dont konw why,and i dont konw how to solve it. Does someone konw? I would really appreciate your help!!

edit retag flag offensive close merge delete


Did you start your pycharm from a terminal?

vonunwerth gravatar image vonunwerth  ( 2021-03-15 19:56:13 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-03-15 07:37:30 -0600

kak13 gravatar image

you didn't install python3 in fully.

Does your code has this line on the top? Like this line:

!/usr/bin/env python3

You aren't using any conda or ancoda, right?

edit flag offensive delete link more


I think i install python3 in fully,but maybe not use conda.I set up a pythonpath and i added the path of 'rclpy' workd, but why?

Ataraxy gravatar image Ataraxy  ( 2021-03-17 21:45:37 -0600 )edit

So, that was the path issue then! I'm glad things fixed on your end! Could you mark your answer as "green check"? So others can get some idea to update their work.

kak13 gravatar image kak13  ( 2021-03-18 05:34:46 -0600 )edit

Question Tools

1 follower


Asked: 2021-03-14 05:23:36 -0600

Seen: 701 times

Last updated: Mar 15 '21