Python modules from .pth files overwrites editable install
18:06 11 Mar 2026

I have a „central“ Python 3.12 venv that is shared by several users.

I wanted to set up a local clone of this environment for developing. To be clever about it, I only set up an empty environment and then placed a .pth file in its site-packages folder that points to the site-packages folder of the central env.

This works like a charm, if have all the packages of my central env available for import in my local env without having to copy them. Only if I update a package, the new version is installed locally and then replaces the one from the central env, since the latter‘s parent folder comes later in sys.path.

However, this seems to fail to work for editable installs: if I use

pip install -e

Inside my local env, pip builds, installs and correctly lists the package as editable. But when I try to import it in a Python session, I always end up with the one from the central env.

What could be the reason and is there a solution?

python pip python-venv