pycharm setup
I am trying to use pycharm as my ide and it doesn't seem to recognize any of the ros libraries(rospy, etc.) even though they are properly installed. If it helps I am using python 3.4.0 and pycharm 4.0.4.
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
I am trying to use pycharm as my ide and it doesn't seem to recognize any of the ros libraries(rospy, etc.) even though they are properly installed. If it helps I am using python 3.4.0 and pycharm 4.0.4.
This is probably similar to running an IDE and getting it to code-complete ROS code.
Have you tried starting pycharm from a terminal in which you have sourced your setup.bash
?
Otherwise make sure to check your PYTHONPATH
, it should contain (at least) /opt/ros/$ros_release/lib/python2.7/dist-packages
.
It probably works, but I'd go for the "sourced environment" option. If anything ever changes in ROS wrt Python setup/paths, you don't have to do anything. Setting the PYTHONPATH
(or adding it to pycharm's setup) would mean you'd have to track any changes in ROS manually.
Don't forget to have a look at:
There is not only a solution for your problem. But also there is a solution for using PyCharm as debugger.
As a better choice for solving your problem, add bash -i -c
to your PyCharm's desktop file
There is something like:
Exec="/opt/pycharm-community-4.0.4/bin/pycharm.sh" %f
change it to:
Exec=bash -i -c "/opt/pycharm-community-4.0.4/bin/pycharm.sh" %f
You can find the desktop file in /usr/share/applications/
with filename pycharm.desktop
or might have another name but includes pycharm and has a .desktop extension.
On ubuntu 16.04, installed the latest PyCharm. There is no pycharm desktop file. But:
./snap/pycharm-community/99/meta/gui/pycharm-community.desktop ./snap/pycharm-community/99/snap/gui/pycharm-community.desktop ./var/lib/snapd/desktop/applications/pycharm-community_pycharm-community.desktop
the files at snap are not editable. because of some sort of read-only file system that snap uses. The file under /var/lib/snapd is editable and it has this line:
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/pycharm-community_pycharm-community.desktop /snap
Surprisingly, PyCharm run from the terminal works fine, while patching .desktop with -i -c options does not enable PyCharm to load environment variables including PYTHONPATH.
As I struggled too, here the modified Exec for the file '/var/lib/snapd/desktop/applications/pycharm-community_pycharm-community.desktop' to solve the sourcing: Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/pycharm-community_pycharm-community.desktop bash -i -c /snap/bin/pycharm-community %f
Asked: 2015-03-05 08:17:03 -0500
Seen: 18,451 times
Last updated: Jul 04 '17
Error assigning a python quaternion
Python savefig to directory [closed]
rostest & Python - Multiple Test Fixtures In Single File
evaluate launch argument as python variable
cannot include custom .msg files in python code
Read rosbag in python at timestamp
What is the correct layout of Python code when using --symlink-install in ROS 2?