Is there a way I can use apt-get install command to install a package and its first level dependencies only instead of all the dependencies recursively?

EDIT: I am dealing with ROS and would like to install a single package with only its first level dependencies. I don't actually want to install or update the system dependencies that this ROS package depends on, "recursively". During running a particular application if any 'dependency-not found' error is thrown, I would like to see what exactly is missing. I hope this helps. PS: Also, it seems that there is an apt-get command to install only the first-level dependencies but couldn't find any. Any help is greatly appreciated.

  • 4
    It is not possible. "First-level" dependencies will not install without there own dependencies. It will be much better if you ask about a real problem. – Pilot6 Feb 26 '17 at 15:17
  • 1
    This sounds like an XY Problem. What are you actually trying to achieve? – David Foerster Feb 26 '17 at 21:03
  • "it seems that there is an apt-get command to install only the first-level dependencies" Why do you think that? – muru Feb 27 '17 at 1:41
  • @muru my mentor said so and asked me to look for the command. – samhitha Feb 27 '17 at 4:03


There is no way to use apt-get and install packages without fulfilling dependencies. You can download the individual packages and use dpkg, but the packages will not be fully installed in that case, and programs may not even be startable.

  • I found a command debtree --max-depth=number that limits the traversal of dependency depth. Is there a way I can integrate this with apt-get install to serve my purpose? something like debtree --max-depth=1|sudo apt-get install ? – samhitha Mar 2 '17 at 4:40
  • No. Use dpkg if you want to ignore dependencies. – muru Mar 2 '17 at 4:47
  • Could you please tell how exactly I can use it. and also, when installing individual dependencies (top-level) using dpkg, won't their dependencies also get installed? – samhitha Mar 2 '17 at 5:54
  • askubuntu.com/a/40781/158442 dpkg doesn't download or install anything other than what it has been told to. – muru Mar 2 '17 at 5:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.