Which package manager should I use when there are multiple to choose from?
For example, if I want to install NumPy, should I do pacman -S python-numpy or pip install numpy? Or if I want to install latte dock, should I download it through KDE Discover or should I do pacman -S latte-dock?
About this post
- Posted
- Archived
- Score
- 0 · 100% up
- Kind
- Text
- ID
- cp5zhy
17 comments
Always pacman. If you must install something with pip use a virtualenv.
is there a way to find out which pip packages I've installed so that I can substitute them with the pacman ones?
as per
pip --help:listList installed packages.Deleted before we saved it.
This is not the full truth, Discover can also install via Flatpak, Snap or (most relevant for OP) via KNewStuff.
Deleted before we saved it.
I use
pacmanto install things that I want to use globally, other package managers are my second choice, I use it only if the package is not available in ArchLinux repos yet or I want to use it locally.Deleted before we saved it.
Pacman is usually the best bet for arch, usually Pacman and Trizen are all you need for packages, there are converters for other package types mainly .deb files Trizen is used to get packages from the AUR so those two alone should cover most of your needs any reason why you don't wanna use pacman straight out?
No reason, I just wanted to know what the best practice was.
Ah, yeah unless it's causing you issues Pacman and Trizen should cover almost everything. Usually the more package managers you have the harder it is to keep straight where a package came from it it starts acting up. There's nothing bad with changing but it's usually just seen as unnecessary effort and added complexity. Good question though!
The best practice is to use the official package manager.
there should be no difference between pacman and Discover (although I found Discover to be a bit buggy at times). Also, if you'd use an AUR manager like trizen,yay,etc.: they all use pacman internally.
As for programming language package managers like pip/venv, npm, rust's cargo or whatever: if you need that package globally (eg if it's a tool you want to use, or as dependency for another arch/AUR package you want to install), you should use pacman. If you only need it for development in said language, you better use pip/venv. So as far as my understanding for python development goes, you should install numpy via virtualenv, because this allows you to install multiple different versions in parallel.
Generally you want to use pacman to manage what is installed on your system. For python scripts that you want installed globally you can use pacman e.g. I use youtube-dl globally so I install that with
pacmanorbrew(I am using a mac at the moment).Whereas pip you will use that to install python dependencies for python project. To use it with virtual-environements.
This will install the popular requests tool into your
virtual environment, however if you exit that virtual-environment usingexitin bash, then you are using the global python again and requests can't be imported.Here is a more complete explanation of how they work:
https://realpython.com/python-virtual-environments-a-primer/
Also of course the arch linux wiki page:
https://wiki.archlinux.org/index.php/Python/Virtual_environment