so I think that I have found the way by looking closely at q295471 and deducing some key commands that were missing. I am adding them below for completeness.
1. Created a custom_deps.yaml with the following content:
myCustomPkg:
ubuntu:
pip:
packages: ["git+https://github.com/user/repo.git@master"]
2. Create file /etc/ros/rosdep/sources.list.d/19-default.list and append custom_deps.yaml to it
As stated in https://docs.ros.org/en/independent/api/rosdep/html/contributing_rules.html
Create a new file in
/etc/ros/rosdep/sources.list.d/ that
points at your forked repository
instead. The filename should use a
lower number so it is processed first.
we can do the same but then for our custom repo, hence:
sudo touch /etc/ros/rosdep/sources.list.d/19-default.list
and then
sudo sh -c 'echo yaml file://$(readlink -f custom_deps.yaml) >> /etc/ros/rosdep/sources.list.d/19-default.list'
3. Update rosdep
rosdep update
If done correctly the following will be seen in the terminal, where you see that the custom_deps.yaml is being used!
Hit file:///home/user/ros2_ws/src/myPackage/custom_deps.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Also, running rosdep resolve myCustomPkg
gave
#pip
git+https://github.com/user/repo.git@master
4. Add your new custom dependency to the package.xml
of the package that depends on it using
```<exec_depend>myCustomPkg</exec_depend>```
5. Install the dependency
Using the command rosdep install --from-paths src/myRosPackage
then installs the dependency
If using
rosdep
, the approach described in the second answer to #q295471 is basically the current best practice afaik.I have got it to work more or less with some addition to #q295471(as can be seen in my answer) only now I am getting a strange error
Would this have anything to do with this approach to adding custom dependencies? Normal pip installation does not indicate this error ...
You might need to tell
pip
the name of the module that will be installed using thegit+https
link. You normally do that using something like this:rosdep
will try to usepip
to figure out whether the dependency was installed. If the name of the Python package is different from the key passed torosdep
, it's likely you'll get complaints.In this case, the
key
maps togit+https://github.com/user/repo.git@master
. I'm not entirely sure howpip
would check that was installed. Hopefully the#egg=
bit helps.Unfortunately I have been unable to get the
#egg=
to generate a successful install throughrosdep
.pip show myCustomPkg
does show what I expectIt looks like this is the code involved in the detection.
Does
pip freeze
show the name of the package (or: the name of therosdep
key)?It could be the full URL is considered the name of the package, which will of course never match, as that's not what
pip
shows.running
pip freeze
does show the name of the package! Is it worthwhile to make an issue on the rosdep repo?You could try to add some
print(..)
s in the.py
s ofrosdep
on your system. I'd be interested to know whetherrosdep
is trying to detect whethergit+https://github.com/user/repo.git@master#egg=myCustomPkg
is installed (as in: that exact same). If that's the case, that would seem to be a likely cause.On a Debian/Ubuntu install, that should be in
/usr/lib/python3/dist-packages/rosdep2/platforms/pip.py
. It's not too nice, but for a quick test you could justsudo nano /usr/lib/python3/dist-packages/rosdep2/platforms/pip.py
and addprint(..)
s inpip_detect(..)
to see what it's doing.I did as you said and can confirm your hypothesis:
what i found is that
while the pip output shows