Skip to content

Local variable "sitedir" is not defined since Python 3.15.0-beta.1 #14426

@FriedrichFroebel

Description

@FriedrichFroebel

Describe the bug

GitHub Actions just switched from Python 3.15.0-alpha.8 to 3.15.0-beta.1 and I am receiving the following error when running sphinx-build -W -b doctest doc/api/ tmp or nearly all other commands:

Error in import line from /opt/hostedtoolcache/Python/3.15.0-beta.1/x64/lib/python3.15/site-packages/sphinxcontrib_jsmath-1.0.1-py3.7-nspkg.pth: import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('sphinxcontrib',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('sphinxcontrib', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('sphinxcontrib', [os.path.dirname(p)])));m = m or sys.modules.setdefault('sphinxcontrib', types.ModuleType('sphinxcontrib'));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 319, in _exec_imports
    File "<string>", line 1, in <module>
  KeyError: "local variable ''sitedir'' is not defined"

How to Reproduce

Install sphinx and run anything importing Python modules, like the Sphinx build, flake8, tests etc.

Environment Information

Successfully installed Jinja2-3.1.6 MarkupSafe-3.0.3 Pygments-2.20.0 alabaster-1.0.0 babel-2.18.0 certifi-2026.4.22 charset_normalizer-3.4.7 djvulibre-python-0.9.3 docutils-0.22.4 flake8-7.3.0 idna-3.13 imagesize-1.5.0 mccabe-0.7.0 numpy-2.4.4 pep8-naming-0.15.1 pycairo-1.29.0 pycodestyle-2.14.0 pyflakes-3.4.0 requests-2.33.1 roman-numerals-4.1.0 snowballstemmer-3.0.1 sphinx-9.1.0 sphinxcontrib-applehelp-2.0.0 sphinxcontrib-devhelp-2.0.0 sphinxcontrib-htmlhelp-2.1.0 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-2.0.0 sphinxcontrib-serializinghtml-2.0.0 urllib3-2.7.0

Sphinx extensions

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions