You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pth files in site-packages of venvs are executed twice #75723
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2017-09-21.09:41:38.759>labels= ['library']
title='pth files in site-packages of venvs are executed twice'updated_at=<Date2020-02-20.11:02:15.996>user='https://github.com/anntzer'
This behavior is different from the one for a pth file in a non-venv site-packages (either the syswide prefix, or the user prefix), which is only executed once.
Activity
anntzer commentedon Sep 21, 2017
All's in the title: "pth files in site-packages of venvs are executed twice". For example, the following code sample prints "1" twice.
python -mvenv /tmp/tmpenv
echo 'import os; print(1)' >/tmp/tmpenv/lib/python3.6/site-packages/foo.pth
source activate /tmp/tmpenv
python
This behavior is different from the one for a pth file in a non-venv site-packages (either the syswide prefix, or the user prefix), which is only executed once.
sinoroc commentedon Feb 20, 2020
https://stackoverflow.com/a/60169657/11138259
Merge branch 'main' into asottile-pythongh-75723
Merge remote-tracking branch 'origin/main' into asottile-pythongh-75723
warsaw commentedon May 8, 2026
@asottile It's funny, weird, and scary that my YT algorithm presented me with your video on this right about the time you tagged us on this ticket!
gh-75723: Fix double evaluation of .pth and .site files in venvs (#14…
pythongh-149819: Fix .pth files not loaded in Python subprocesses
gh-149819: fix .pth and .start file processing in subprocess when inh…
[3.15] gh-149819: fix .pth and .start file processing in subprocess w…
tcely commentedon May 22, 2026
@warsaw After your latest commits; what's left outstanding for this issue?
warsaw commentedon May 22, 2026
Thanks for the ping @tcely - I think we can close this now.