When reading tutorials and readmes I often see people advertising to install python packages with pip
, even when they are using an operating system, which has a nice package manager like apt
. Yet in real life I only met people who would only install things with their OS's package manager, reasoning that this package manager will treat all packages the same, no matter if python or not.
There are two main reasons that Pythonistas generally recommend pip
. The first is that it is the one package manager that is pretty much guaranteed to come with a Python installation, and therefore, independent of the OS on which you are using it. This makes it easier to provide instructions that work on Windows and OS X, as well as your favourite Linux.
Perhaps more importantly, pip
works very nicely with virtualenv
, which allows you to easily have multiple conflicting package configurations and test them without breaking the global Python installation. If I remember correctly, this is because pip
is itself a Python program and it automatically runs within the current virtualenv
sandbox. OS-level package managers obviously do not do this, since it isn't their job.
Also, as @Henry points out below, it's easier to just list your package in a single place (PyPI) rather than depending on the Debian/Ubuntu/Fedora maintainers to include it in their package list. Less popular packages will almost never make it into a distribution's package list.
That said, I often find that installing global libraries (numpy
, for example) is easier and less painful with apt-get
or your favourite alternative.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With