What is the difference between a package manager and a dependency manager?

- 722
- 1
- 7
- 22

- 2,010
- 1
- 22
- 31
-
2Duplicate: http://stackoverflow.com/questions/21587901/difference-between-dependency-and-package-managers – Thilo Dec 04 '14 at 03:34
-
Question and Answer in that post is not short and understandable for me. I wanted key difference and after long research I find out short answer and wrote down. What I wanted is answer for when someone confused and want to shortly look. Thanks anyway. – Erlan Dec 04 '14 at 09:02
2 Answers
TLTR: Package Manager is used for SYSTEM and Dependency Manager for PROJECT
Package Manager - is used to configure system, ie to setup your development environment and with these settings you can build many projects.
Dependency Manager - Is specific to project. You manage all dependencies for a single project and those dependencies are going to be saved on your project. When you start another project you should manage your dependencies again.
EXAMPLE: In PHP world there is COMPOSER as dependency manager and PEAR as package manager. When using composer all your settings and extensions are for single project where pear settings to setup new extension and library to php core.

- 2,010
- 1
- 22
- 31
-
I think the confusion comes from the Python world where these terms are used interchangeably. And this makes sense because in Python your project dependencies are system wide global packages. That's the very reason for virtual environment managers like conda and penv come to exist. – hrzafer Jan 22 '19 at 15:30
There is an excellent and simple explanation on Composer's website:
Composer is not a package manager in the same sense as Yum or Apt are. Yes, it deals with "packages" or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. vendor) inside your project. By default it does not install anything globally. Thus, it is a dependency manager.

- 141
- 1
- 8
-
But with the composer, you can install packages globally too! How does it count? – rahul286 Jun 21 '17 at 10:00
-
2@rahul286 Composer can install globally as a convenience, while it's not its main focus or architecture philosophy. This affects the dependency resolution algorithm, for instance, which behaves differently in Composer and NPM. If I'm not mistaken, Composer reads all the dependency resolution tree and tries to find common ancestor packages that suffice all the packages constraints. If it can't do that, it does not complete succesfully. I'm not familiar with NPM, but I think that in NPM you get a package of each version, instead of a common ancestor. – Lucas Bustamante Sep 08 '19 at 15:11
-
3Interesting read: https://medium.com/learnwithrahul/understanding-npm-dependency-resolution-84a24180901b – Lucas Bustamante Sep 08 '19 at 15:16