Reference
Hardlink Caveats
What to know about shared inodes when PVM deduplicates packages via hardlinks.
Package deduplication uses hardlinks to share files between the global cache and each environment's site-packages. This is what makes deduplication effective, but it has a consequence worth understanding.
Shared inodes: Multiple environments point to the same physical file on disk. If you manually modify a cached package file, the change propagates to every environment that hardlinks to that file.
Implications
- Do not edit installed package files in-place. Changes will silently affect all other environments sharing that file.
- Upgrades are safe.
pip install --upgradeinstalls a new version, which gets its own cache entry and new hardlinks—existing files are not touched. - Uninstall is safe. Removing a package from one environment only removes the hardlink in that environment; the cache entry remains until
pvm cache cleandetermines it is orphaned. - Cross-filesystem moves will break hardlinks. If you move
~/.pvmto a different filesystem partition, hardlinks become copies. Re-runpvm pip syncto re-establish deduplication.
Recommended practice
- Avoid manually editing files inside
~/.pvm/envs/or~/.pvm/packages/. - Use
pip install --upgrade <package>or create a new environment if you need a different version. - Run
pvm cache cleanperiodically to remove packages no longer referenced by any environment.