Search code examples
pythonpipcondapython-venv

Lightweight usage of python virtual environments


When using one python environment for each single project, dependencies are well managed but a lot of heavy libraries end up being copied (python of course but also dependencies like pytorch worth several GB). Is there a way to use environments while maintaining single shared versions of these libraries?


Solution

  • You tagged conda, which does exactly that. Libraries are downloaded and extracted into a single, shared directory and linked into environments. In case you isntall the same version of a library to multiple envs, it only occupies space once.

    Note: This is the default case. There can of course be scenarios where your filesystem structure or OS do not support hard-linking.