Sometimes Pycharm is not able to import rospy (“No module named rospy“). There are different ways to fix this, but I’m going for the quicker and less technical one.
In Pycharm, open file/settings. Go to the interpreter of the project you are working onto and look in the Project interpreter dropdown menu.
- Select “Show All”
On the new window look for the last button (“Show paths for the selected interpreter”)
- Select “Add” (plus sign or Alt+Ins)
- Enter your ROS packages directory (/opt/ros/kinetic/lib/python2.7/dist-packages)
Apply and wait for Pycharm to load the new packages. Easy as it seems.