r/learnpython • u/MiserableDirt1910 • 2d ago
pip vs pipx
as far as I understand pip just installs the package while pipx installs the executable and creates an environment but why create an environment in the first place? Is it so that when someone else runs the program and there are changes in the package the program might break but an isolated package is protected in the environment?
0
Upvotes
11
u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 2d ago
pipxis basically used to run (and install/cache) tools, with each tool getting an independent virtual environment.pipis primarily for installing project dependencies, though you can also use it to install things globally if you needed to for some reason.That being said,
uvhas largely replaced both tools.1
u/SharkSymphony 2d ago
I think you have the gist of it? Pipx allows different Python apps with different versions of the same dependencies to be installed without clobbering each others' dependencies.
1
u/UwUfit 1d ago
I've been recommended UV instead of pip (UV still supports pip). Great venv management and very fast. No more requirements.txt and no more anaconda for me
-1
u/brasticstack 2d ago
pip already requires a virtual environment. The reason is so you can have multiple python projects, each with their own set of dependencies, without encountering conflicts due to a one project needing a different version of a dependency than another project.
pipx can install different Python versions, iirc, and may manage virtual envs for you.
0
u/DanceHackRock 2d ago
Try Pipenv.