Skip to content

python3.15 -m venv venv315 crashes with a KeyError #149845

@bblommers

Description

@bblommers

Bug 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-venvRelated to the venv moduletype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions