Resolve Python Modules of a Catkin Workspace in CLion

402 Views Asked by At

I have a catkin workspace that consists of both C++ and Python packages. I have problems in resolving python modules in CLion and I need help with configuring that.

I have already copied the top level CMakeLists.txt to my workspace source directory (my_ws/src). When I build by using the top level cmake, and then source cmake-build-debug/devel/setup.zsh, and launch python shell afterwards, everything is fine: workspace structure is resolved and i can use autocompletion. The same applies when i source my_ws/devel_debug/setup.zsh.

In Clion Terminal, when i enter $ echo $PYTHONPATH i get /opt/ros/kinetic/lib/python2.7/dist-packages, which is insufficient. It lacks the dir at which __init__.py files of my packages are located.

In Clion settings, under [Build, Execution, Deployment] window my [Python Interpreter] settings are set correct: project interpreter is my python virtual environment, and the path my_ws/src/cmake-build_debug/devel/lib/python2.7/dist-packages/ is already added. I left the CMake settings as they are, because these do not allow to specify anything about $PYTHONPATH -- at least i couldn't figure out how!

When i run CMake in Clion, i see my_ws/src/cmake-build-debug/devel listed as CATKIN_DEVEL_PREFIX under my PYTHONPATH.

P.S. I have already checked Clion or cmake does not see environment variable and some other pages to get some clues, but they didn't help.

0

There are 0 best solutions below