GeezerVison is showing github.com — `python3.15 -m venv venv315` crashes with a KeyError · Issue #149845 · python/cpython
python3.15 -m venv venv315 crashes with a KeyError #149845
DescriptionBug report
Bug description:
Invoking the venv module results in a KeyError:
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"
OS details
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy
Python details
Clean installation using sudo apt install python3.15 python3.15-dev python3.15-venv.
Version: Python 3.15.0b1
CPython versions tested on:
3.15
Operating systems tested on:
Linux Activityhugovk commented on May 14, 2026 When you say crash, does it fail to create the venv315 dir, 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.pth file:
The latest 0.19.1 is from this year:
And the wheel no longer contains that legacy file:
bblommers commented on May 14, 2026 Hi @hugovk!
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! hugovk commented on May 14, 2026 Yes, let's close as duplicate. Thanks for the report, it helps to see other occurrences.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|