Robotics StackExchange | Archived questions

When is setup.py necessary?

Sorry if this is a basic question.

I am working through the ROS tutorials on the wiki and some external sites written in python and I confused about when I need follow the procedures for python packages, such as creating a setup.py file and having catkinpythonsetup() in my CMakeLists.txt file as explained here: http://docs.ros.org/kinetic/api/catkin/html/howto/format2/installing_python.html

In the wiki tutorial on writing a simple publisher and subscriber in python (http://wiki.ros.org/rospy_tutorials/Tutorials/WritingPublisherSubscriber), I can use catkin_make to build my nodes and run them without any python-specific modifications to my package or CMakeList

I am running ROS Kinetic on Ubuntu 16.04 LTS inside VMWare Workstation 12 on an HP Elitebook 840-G3.

Thank you very much.

Asked by loubohan on 2018-05-28 03:14:38 UTC

Comments

Answers

catkin_python_setup() and the Setup.py are needed if you want to install the Python scripts/modules that you program. They basically define how to copy things from your workspace to the place where you want to install.

You also Need that if you write a module in pkg A and want to use/Import it in pkg B.

The tutorials work because there you just execute the script directly in your workspace. There is no Installation involved.

For modules, however, it is mandatory.

Asked by mgruhler on 2018-05-29 02:38:50 UTC

Comments

Thank you very much!

Asked by loubohan on 2018-05-29 04:23:35 UTC