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

pycharm setup

asked 2015-03-05 08:17:03 -0600

Mr. CEO gravatar image

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.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
8

answered 2015-03-05 08:21:35 -0600

gvdhoorn gravatar image

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.

edit flag offensive delete link more

Comments

Thanks, adding the PYTHONPATH to the Pycharm Environment Variables fixed the problem

Mr. CEO gravatar image Mr. CEO  ( 2015-03-05 09:44:58 -0600 )edit
2

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.

gvdhoorn gravatar image gvdhoorn  ( 2015-03-05 09:50:48 -0600 )edit
1

answered 2017-07-04 05:51:38 -0600

tekin gravatar image

updated 2017-07-04 06:14:24 -0600

Don't forget to have a look at:

http://wiki.ros.org/IDEs

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.

edit flag offensive delete link more

Comments

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

wintermute gravatar image wintermute  ( 2018-11-25 08:17:00 -0600 )edit
1

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

wintermute gravatar image wintermute  ( 2018-11-25 08:21:18 -0600 )edit

Same here, I have been wondering how to source before launching Pycharm installed via snap.

xieshuaix gravatar image xieshuaix  ( 2018-12-12 01:32:32 -0600 )edit

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.

volume_8091 gravatar image volume_8091  ( 2019-02-13 05:44:53 -0600 )edit

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

Tobi gravatar image Tobi  ( 2021-11-02 09:18:49 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-03-05 08:17:03 -0600

Seen: 18,804 times

Last updated: Jul 04 '17