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

rosdep install specific version of dependencies

asked 2021-04-15 10:20:14 -0600

definitive gravatar image

Let's suppose I want to install scikit-image 0.15.0. I'm checking scikit-image lib within rosdep db (returns python-skimage-pip -> scikit-image). Then fill package.xml (as described here) with

  <exec_depend version_eq="0.15.0">python-skimage-pip</exec_depend>

and type

rosdep install --from-path src/my_package

As a result I got scikit-image with newest version (0.18.1). How to force rosdep to follow defined version?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-04-15 12:17:46 -0600

tfoote gravatar image

Rosdep does not support specific version dependencies.

That feature was added to the package xml for enforcement between package versions.

Technically it would be possible to force a version installed for pip packages. However we specifically don't allow specifying versions as we have no way to generically do conflict resolution between packages which might declare different versions selected. Whereas the rosdep database is designed specifically to provide a consistent version that everyone that everyone can rely upon across the system.

edit flag offensive delete link more

Comments

So what is the proper way to install specific version of python packages within ROS project? Should I create a virtual environment, locate requirements.txt in package root and install it straight via pip? Seems unprofessional.

definitive gravatar image definitive  ( 2021-04-16 05:05:48 -0600 )edit
1

Correct you should not generally override the version on the system. You can do it if you're only ever expecting users to work from source and that they will all know about the full system configuration and won't get suprised if another package with that same dependency starts failing due to the alternative version. (In reality that sort of user is only a power user/deployment expert. And even then they're not going to want to be working from source.)

It's generally not recommended to rely on a very specific version, but to make sure that your code is compatible with the standard versions available via package managers on the distro's target platforms.

To do it properly you should embed a virtualenv inside of your package and keep it isolated such that it won't interfere with any other packages in the workspace or on the system.

tfoote gravatar image tfoote  ( 2021-04-16 19:22:15 -0600 )edit
1

So what is the proper way to install specific version of python packages within ROS project? Should I create a virtual environment, locate requirements.txt in package root and install it straight via pip?

It's not necessarily official or proper, but catkin_virtualenv was created to do what you describe, while still being 100% compatible with the regular Catkin workflow and ROS workspaces.

It basically does what @tfoote suggests ("embedding a venv inside your package"), but in a more automated way.

gvdhoorn gravatar image gvdhoorn  ( 2021-04-17 09:20:07 -0600 )edit

@gvdhoorn is that ROS 1 specific? is the same available for ROS 2?

Also, there's currently a PR open to make rosdep support versions in pip:

https://github.com/ros-infrastructure...

andrestoga gravatar image andrestoga  ( 2023-03-21 12:36:11 -0600 )edit

catkin_virtualenv is only for ROS 1, as the catkin in the name implies.

There is a "ROS 2 port" (basically a rewrite) at esol-community/ament_virtualenv. I'm not sure what the status of it is. It's been 4 years since I last looked at it.

gvdhoorn gravatar image gvdhoorn  ( 2023-03-21 12:42:34 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2021-04-15 10:20:14 -0600

Seen: 1,058 times

Last updated: Apr 15 '21