Robotics StackExchange | Archived questions

Why are installed ROS 2 humble python packages split in two directories

Cross-post on robotics.stackexchange.com

Since ROS 2 Humble on Ubuntu 22.04, I noticed that now ROS 2 Humble python packages are split between two directories

/opt/ros/humble/lib/python3.10/site-packages
And
/opt/ros/humble/local/lib/python3.10/dist-packages

For example, tf2_ros is installed under /opt/ros/humble/lib/python3.10/site-packages/tf2_ros
and tf2_py is installed under /opt/ros/humble/local/lib/python3.10/dist-packages/tf2_py

From what I can see, it was not the case before (for Foxy and Galactic, at least). And I was wondering why is it split like this?

This brings the issue that if you source your ROS 2 Humble installation before installing any packages, installing files in local/lib/python3.10/dist-packages this subdirectory won't be added to your PYTHONPATH environment variable.

This force to resource the environment.

Asked by GuillaumeB on 2022-11-29 08:55:44 UTC

Comments

Hello,

I don't know if I will be able to answer you 100% or not, but here is what I have understood.

dist-packages is the debian-specific directory where apt and friends install their stuff, and site-packages is the standard pip directory.

The package which contains CPP files compiled CPP files (.so) or python script which is using CPP file. will be stored in dist-packages. And the file which executes in python will have site-packages.

I may be wrong.

Asked by Ranjit Kathiriya on 2022-11-30 12:06:50 UTC

There are also python executable files in dist-packages. I could understand that packages not using CMakeLists.txt but pure python were installed in the dist-packages directory. But in the end, all my packages are installed through Debians. So that doesn't explain the "why".

Asked by GuillaumeB on 2022-12-01 08:43:22 UTC

Closing this in favor of the StackExchange question to avoid duplication of efforts. https://robotics.stackexchange.com/questions/24088/why-are-installed-ros-2-humble-python-packages-split-in-two-directories

Asked by tfoote on 2022-12-09 20:24:32 UTC

Answers