Rosdep for pip is broken on Jazzy

rosdep for pip is completely broken on Ubuntu 24.04 (i.e. Jazzy): Rodsep fails to install pip packages on Python3.11+ · Issue #978 · ros-infrastructure/rosdep · GitHub. This issue (and a corresponding PR to fix) has been open for 3 weeks with no activity from maintainers. This seems like an important issue, since rosdep is the tool that can parse dependencies in package.xml in source builds.

Definitely needs to be fixed soon but as a workaround you can turn on the “break-system-packages” option in the global pip config. Configuration - pip documentation v24.2

1 Like

Thanks, that’s a helpful workaround

One way to solve this, without allowing “break-system-packages” is to use a virtual environment for python and activating it before running rosdep.

I would normally run,
sudo apt install python3-venv
python3 -m venv /opt/myvenv
source /opt/myenv/bin/activate
rosdep install --from-path src -y

Hope, it helps.

1 Like

rosdep is designed to treat pip like an alternative system-level package manager. Deviating from this approach is not easily achievable without a significant rethinking of how pip packages are managed. In the meantime rosdep can provide an explicit check and recommended remediation.

I’ve drafted ros-infrastructure/rosdep#979 to have rosdep check for the necessary configuration and instruct the user to apply it.

1 Like

@nuclearsandwich do you have a recommendation on how to integrate this change with a CI system?

My first thought was that setting PIP_BREAK_SYSTEM_PACKAGES=1 in the environment should just do it, but because rosdep wraps installations in sudo internally the user’s environment variables aren’t passed through. In my linked PR I’m considering passing that environment variable through from the user environment to the sudo environment when present.

Setting the following in /etc/pip.conf is probably the most guaranteed CI solution at present:

# Allow rosdep to install system-wide pip packages
[install]
break-system-packages = true
1 Like

Thanks. I think setting that environment variable is working with ROS-I’s CI actions on Github. If it’s not working like I think it is I’ll start modifying /etc/pip.conf instead.

I am adding a dedicated article to rosdep’s documentation:

I tried to include some CI recipes in it. Let me know which, if any work for you.

On Friday last week I released rosdep 0.25.0 which includes a pip configuration check when Python >=3.11 is detected and provides instructions for configuring pip to allow rosdep installation.

Hi @nuclearsandwich, sorry for the ping but it seems that 0.25.0 also brought back the pkg_ressources deprecation warning when installed from apt (the pip package doesn’t seem affected). See the related issue. Not sure why that is but I’d be interested to know :+1:

Thanks for filing the issue. My guess is that it has to do with the environment I created the debs in. I’ll take a look and see if I can resolve it in a 0.25.1.

1 Like

On a side note, if pip doesn’t work with PIP_BREAK_SYSTEM_PACKAGES=1, pyenv may be an alternative way to install system-wide packages with access to system site-packages without using virtual environments and without breaking system packages:

pyenv virtualenv system --system-site-packages ros
pyenv global ros
rosdep install --from-path src -y
3 Likes

For me it worked when I created the pip.conf file under
/etc/pip.conf with

[install]
break-system-packages = true

And then I had to upgrade setuptools also with

python3 -m pip install --upgrade setuptools
1 Like

Wouldn’t it be possible to use pip install --prefix=<path-to-install-directory-in-ros-workspace> to install packages only in the current workspace?

1 Like

This sounds like a great option. But what if there isn’t any active workspace? (You can call rosdep without having any workspace sourced)