Using Python in ROS can feel like a super-power, but actually importing external libraries can be confusing.
This is because ROS 1 packages are not designed to be shared on PIP, and so they don't follow the normal python conventions (using setup.py depenencies, or requirements.txt).
So how can you grab a great python library like scikit-learn to use in your ROS robot system? You have to use ROSDEP.
ROSDEP looks at your package.xml and tries to install whatever you have stated is a dependency for your build. If you wanted scikit-learn available whenever your packages scripts are run, you need to add:
<exec_depends>python3-scikit-learn</exec_depends>
But how do you know which scikit? How do you know to put python3, and what exactly will ROSDEP actually do when it see's the above command?
You have to go and checkout the repo that ROSDEP uses to lookup what to do, for python scripts it is:
https://github.com/ros/rosdistro/blob/master/rosdep/python.yaml
If you search that yaml file you'll be able to find hopefully whatever python package you need.
Although I'm not sure what you have to do if ROSDEP doesn't have what you need listed, does anyone else know?