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.
When reading tutorials and readmes I often see people advertising to install python packages
Share
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,
pipworks very nicely withvirtualenv, 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 becausepipis itself a Python program and it automatically runs within the currentvirtualenvsandbox. 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 withapt-getor your favourite alternative.