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.
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.
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2015-03-05 08:17:03 -0600
Seen: 14,614 times
Last updated: Jul 04 '17
To start a node without rosrun or roslaunch in different IDEs [closed]
How to debug a ros node with pycharm?
Unsubscribing from ROS Topic - Python
does ros1_bridge support communicate cross-language services? [closed]
Creating a Subscriber in python
how to add or use tfx python module for catkin?
MoveIt! Adding Collision Objects
Why are overrides in setup.cfg necessary in Python ROS2 packages?