{"id":24479,"library":"pytorch-sphinx-theme","title":"PyTorch Sphinx Theme","description":"PyTorch Sphinx Theme is a Sphinx theme used in PyTorch documentation. The current version is 0.4.9, with release cadence on demand. It provides a consistent look and feel for PyTorch-related documentation projects.","status":"active","version":"0.4.9","language":"python","source_language":"en","source_url":"https://github.com/pytorch/pytorch_sphinx_theme","tags":["sphinx","theme","documentation","pytorch"],"install":[{"cmd":"pip install pytorch-sphinx-theme","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Importing the version string is a common pattern.","wrong":"","symbol":"PyTorchSphinxTheme","correct":"from pytorch_sphinx_theme import __version__"}],"quickstart":{"code":"# conf.py\nimport pytorch_sphinx_theme\nhtml_theme = 'pytorch_sphinx_theme'\nhtml_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]","lang":"python","description":"Basic configuration to use the theme in Sphinx docs."},"warnings":[{"fix":"Set html_theme = 'pytorch_sphinx_theme'.","message":"Do not use 'pytorch-sphinx-theme' in html_theme; use the string 'pytorch_sphinx_theme' (underscores, not hyphens).","severity":"gotcha","affected_versions":"all"},{"fix":"Install 'pytorch-sphinx-theme' from PyPI.","message":"The package 'pytorch-sphinx-theme' was renamed from 'pytorch_sphinx_theme' on PyPI. The import remains 'pytorch_sphinx_theme', but ensure you install the correct package.","severity":"deprecated","affected_versions":">=0.4.0"},{"fix":"Check compatibility with your Sphinx version.","message":"The theme requires Sphinx >= 1.6, but some features may not work with Sphinx >= 4.0 without additional configuration.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()] only for older versions; for 0.4.x, set html_theme = 'pytorch_sphinx_theme' and let Sphinx handle the path automatically.","cause":"The function get_html_theme_path was removed in newer versions (0.4.x) or may not be available.","error":"pytorch_sphinx_theme.get_html_theme_path() AttributeError: module 'pytorch_sphinx_theme' has no attribute 'get_html_theme_path'"},{"fix":"pip install pytorch-sphinx-theme # installs the package; import as pytorch_sphinx_theme","cause":"You installed 'pytorch-sphinx-theme' but the import path is 'pytorch_sphinx_theme' (hyphen vs underscore). It's correct; if the error persists, reinstall the package.","error":"ModuleNotFoundError: No module named 'pytorch_sphinx_theme'"},{"fix":"Ensure you have installed pytorch-sphinx-theme and set html_theme = 'pytorch_sphinx_theme' (underscores).","cause":"The html_theme is set incorrectly or the theme is not installed in the Sphinx environment.","error":"Theme 'pytorch_sphinx_theme' not found"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}