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
python3.15 -m venv venv315 crashes with a KeyError #149845
Error in import line from /usr/lib/python3/dist-packages/ruamel.yaml-0.17.16-nspkg.pth: import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('ruamel',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('ruamel', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('ruamel', [os.path.dirname(p)])));m = m or sys.modules.setdefault('ruamel', types.ModuleType('ruamel'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
Traceback (most recent call last):
File "<frozen site>", line 325, in _exec_imports
File "<string>", line 1, in <module>
KeyError: "local variable ''sitedir'' is not defined"
You're right, the venv is created despite the error, and (from what I can tell) everything works as it should. I can source it as normal and install dependencies.
I did notice the other issue - but I wasn't sure whether it was actually the same root cause. Happy to close this if you think it is a straight duplicate!
Activity
hugovk commentedon May 14, 2026
When you say crash, does it fail to create the
venv315dir, or does it create it despite the error message?Looks like a duplicate of #149671.
ruamel.yaml 0.17.16 is from 2021:
And contains an old
*py3.9-nspkg.pthfile:The latest 0.19.1 is from this year:
And the wheel no longer contains that legacy file:
bblommers commentedon May 14, 2026
Hi @hugovk!
You're right, the
venvis created despite the error, and (from what I can tell) everything works as it should. I cansourceit as normal and install dependencies.I did notice the other issue - but I wasn't sure whether it was actually the same root cause. Happy to close this if you think it is a straight duplicate!
hugovk commentedon May 14, 2026
Yes, let's close as duplicate. Thanks for the report, it helps to see other occurrences.
KeyError: "local variable ''sitedir'' is not defined"#149671