Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run with Sphinx 8.2.0 #825

Closed
arafune opened this issue Feb 19, 2025 · 8 comments · Fixed by #826
Closed

Cannot run with Sphinx 8.2.0 #825

arafune opened this issue Feb 19, 2025 · 8 comments · Fixed by #826

Comments

@arafune
Copy link

arafune commented Feb 19, 2025

sphinx-doc/sphinx#13352, sphinx-doc/sphinx#13364

@byrdie
Copy link

byrdie commented Feb 19, 2025

I'm experiencing the same problem.

jenshnielsen added a commit to jenshnielsen/nbsphinx that referenced this issue Feb 19, 2025
Closes spatialaudio#825

Implicit imports (imports that rely on the fact
that importing a module imports another module
such as a submodule) makes the code vulnerable
to breakage due to refactors in the dependent
code. Such as the changes in Sphinx 8.2.0 that
caused spatialaudio#825

This replaces all implicit imports that I
could find by explicit imports.
jpwgnr added a commit to jpwgnr/sweights that referenced this issue Feb 19, 2025
HDembinski added a commit to sweights/sweights that referenced this issue Feb 19, 2025
Sphinx version 8.2.0 broke nbsphinx, temporary fix is to require the
older version until the issue is resolved either in nbsphinx or sphinx.

spatialaudio/nbsphinx#825

---------

Co-authored-by: Lukas Bertsch <lukas.bertsch@tu-dortmund.de>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
raydouglass pushed a commit to rapidsai/cuml that referenced this issue Feb 19, 2025
The most recent release of sphinx version 8.2.0 is breaking nbsphinx,
see: spatialaudio/nbsphinx#825

This PR pins sphinx to version 8.1.*.
@kaushikcfd
Copy link

Same.

I guess we need an import statement in nbsphinx/__init__.py.

$ python
Python 3.13.2 | packaged by conda-forge | (main, Feb 17 2025, 14:10:22) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sphinx
>>> sphinx.__version__
'8.2.0'
>>> sphinx.util.console
Traceback (most recent call last):
  File "<python-input-2>", line 1, in <module>
    sphinx.util.console
  File "/home/kaushikggg/.mambaforge/envs/py312_env/lib/python3.13/site-packages/sphinx/util/__init__.py", line 157, in __getattr__
    raise AttributeError(msg)
AttributeError: module 'sphinx.util' has no attribute 'console'
>>> import sphinx.util.console
>>> sphinx.util.console.brown
<function _create_colour_func.<locals>.inner at 0x7f787098c220>

riclarsson added a commit to atmtools/arts that referenced this issue Feb 20, 2025
Currently leads to build errors, probably due to extension
incompatibility of nbsphinx.

See spatialaudio/nbsphinx#825
ewuerger added a commit to DSD-DBS/capella-polarion that referenced this issue Feb 20, 2025
github-actions bot pushed a commit to ARM-software/lisa that referenced this issue Feb 20, 2025
Avoid nbsphinx issue by forcing Sphinx in a supported version until this
gets resolved:
spatialaudio/nbsphinx#825
Jakob-Unfried added a commit to tenpy/tenpy that referenced this issue Feb 20, 2025
Looks like nbsphinx does not support sphinx 8.2.0 yet:
spatialaudio/nbsphinx#825
zmbc added a commit to zmbc/nbsphinx that referenced this issue Feb 20, 2025
@josephburkhart
Copy link

josephburkhart commented Feb 20, 2025

I am having the same issue, noticed it when I was testing a build on readthedocs today.

The full traceback:
Traceback (most recent call last):
      File "/home/docs/checkouts/readthedocs.org/user_builds/coxeter/conda/252/lib/python3.13/site-packages/sphinx/events.py", line 404, in emit
        results.append(listener.handler(self.app, *args))
                       ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/coxeter/conda/252/lib/python3.13/site-packages/nbsphinx/__init__.py", line 1714, in html_collect_pages
        sphinx.util.console.brown, len(files)):
        ^^^^^^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/coxeter/conda/252/lib/python3.13/site-packages/sphinx/util/__init__.py", line 157, in __getattr__
        raise AttributeError(msg)
    AttributeError: module 'sphinx.util' has no attribute 'console'
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/home/docs/checkouts/readthedocs.org/user_builds/coxeter/conda/252/lib/python3.13/site-packages/sphinx/cmd/build.py", line 432, in build_main
        app.build(args.force_all, args.filenames)
        ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/coxeter/conda/252/lib/python3.13/site-packages/sphinx/application.py", line 426, in build
        self.builder.build_update()
        ~~~~~~~~~~~~~~~~~~~~~~~~~^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/coxeter/conda/252/lib/python3.13/site-packages/sphinx/builders/__init__.py", line 375, in build_update
        self.build(
        ~~~~~~~~~~^
            to_build,
            ^^^^^^^^^
        ...<2 lines>...
            method='update',
            ^^^^^^^^^^^^^^^^
        )
        ^
      File "/home/docs/checkouts/readthedocs.org/user_builds/coxeter/conda/252/lib/python3.13/site-packages/sphinx/builders/__init__.py", line 457, in build
        self.finish()
        ~~~~~~~~~~~^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/coxeter/conda/252/lib/python3.13/site-packages/sphinx/builders/html/__init__.py", line 688, in finish
        self.finish_tasks.add_task(self.gen_pages_from_extensions)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/coxeter/conda/252/lib/python3.13/site-packages/sphinx/util/parallel.py", line 46, in add_task
        res = task_func()  # type: ignore[call-arg]
      File "/home/docs/checkouts/readthedocs.org/user_builds/coxeter/conda/252/lib/python3.13/site-packages/sphinx/builders/html/__init__.py", line 707, in gen_pages_from_extensions
        for pagelist in self.events.emit('html-collect-pages'):
                        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/coxeter/conda/252/lib/python3.13/site-packages/sphinx/events.py", line 415, in emit
        raise ExtensionError(
        ...<4 lines>...
        ) from exc
    sphinx.errors.ExtensionError: Handler <function html_collect_pages at 0x7f610a4a2ac0> for event 'html-collect-pages' threw an exception (exception: module 'sphinx.util' has no attribute 'console')
Contents of my `.readthedocs.yml`:
version: 2
build:
  os: ubuntu-22.04
  tools:
    python: "mambaforge-4.10"
  jobs:
    pre_build:
      - echo "Copying static X3D files..."; mkdir -p $READTHEDOCS_OUTPUT/html/_static/x3d; cp -r ./doc/source/_static/x3d $READTHEDOCS_OUTPUT/html/_static
formats:
    - htmlzip
conda:
    environment: doc/environment.yml
python:
    install:
        - method: pip
          path: .
sphinx:
    configuration: doc/source/conf.py
Contents of my `environment.yml`:
channels:
- conda-forge
- defaults
dependencies:
- numpy
- pandas
- rowan>=1.2
- scipy
- jupyter
- sphinx
- furo>=2023.9.10
- sphinxcontrib-bibtex>=2.0.0
- autodocsumm
- nbsphinx>=0.9.6
- fresnel
- matplotlib
- pip:
  - plato-draw
- sphinx
name: coxeter-readthedocs

What fixed the issue was pinning the version of sphinx to 8.1.3 in environment.yml.

ethanwhite added a commit to ethanwhite/DeepForest that referenced this issue Feb 24, 2025
A sphinx update broke nbsphinx. sphinx views this as an issue with nbsphinx,
so the fix is waiting on a new release of nbsphinx. This temporarily limits sphinx
to before the downstream breaking change until there is a new nbsphinx release.

See: spatialaudio/nbsphinx#825
wshanks added a commit to wshanks/qiskit-experiments that referenced this issue Feb 24, 2025
The currently latest release of nbsphinx (0.9.6) is not compatible with
Sphinx 8.2.0, so here Sphinx is pinned to `<8.2`. See:

spatialaudio/nbsphinx#825

The issue is that nbsphinx does `import sphinx` and relies `sphinx` to
import all of its submodules which it no longer does.

Note -- qiskit-experiments mainly uses `jupyter-sphinx` now but it still
uses the `nbgallery` directive for the landing pages for the tutorials,
so it can not simply be dropped as a dependency (maybe the gallery could
be formatted without it).

Closes qiskit-community#1513
github-merge-queue bot pushed a commit to qiskit-community/qiskit-experiments that referenced this issue Feb 24, 2025
The currently latest release of nbsphinx (0.9.6) is not compatible with
Sphinx 8.2.0, so here Sphinx is pinned to `<8.2`. See:

spatialaudio/nbsphinx#825

The issue is that nbsphinx does `import sphinx` and relies `sphinx` to
import all of its submodules which it no longer does.

Note -- qiskit-experiments mainly uses `jupyter-sphinx` now but it still
uses the `nbgallery` directive for the landing pages for the tutorials,
so it can not simply be dropped as a dependency (maybe the gallery could
be formatted without it).

Closes
#1513
mergify bot pushed a commit to qiskit-community/qiskit-experiments that referenced this issue Feb 25, 2025
The currently latest release of nbsphinx (0.9.6) is not compatible with
Sphinx 8.2.0, so here Sphinx is pinned to `<8.2`. See:

spatialaudio/nbsphinx#825

The issue is that nbsphinx does `import sphinx` and relies `sphinx` to
import all of its submodules which it no longer does.

Note -- qiskit-experiments mainly uses `jupyter-sphinx` now but it still
uses the `nbgallery` directive for the landing pages for the tutorials,
so it can not simply be dropped as a dependency (maybe the gallery could
be formatted without it).

Closes
#1513

(cherry picked from commit 28d8b35)
wshanks added a commit to qiskit-community/qiskit-experiments that referenced this issue Feb 25, 2025
) (#1518)

The currently latest release of nbsphinx (0.9.6) is not compatible with
Sphinx 8.2.0, so here Sphinx is pinned to `<8.2`. See:

spatialaudio/nbsphinx#825

The issue is that nbsphinx does `import sphinx` and relies `sphinx` to
import all of its submodules which it no longer does.

Note -- qiskit-experiments mainly uses `jupyter-sphinx` now but it still
uses the `nbgallery` directive for the landing pages for the tutorials,
so it can not simply be dropped as a dependency (maybe the gallery could
be formatted without it).

Closes
#1513
<hr>This is an automatic backport of pull request #1514 done by
[Mergify](https://mergify.com).

Co-authored-by: Will Shanks <willshanks@us.ibm.com>
geographika added a commit to geographika/OWSLib that referenced this issue Feb 26, 2025
althonos added a commit to althonos/pyhmmer that referenced this issue Feb 27, 2025
althonos added a commit to althonos/pyhmmer that referenced this issue Feb 27, 2025
geographika added a commit to geopython/OWSLib that referenced this issue Feb 28, 2025
@mgeier mgeier changed the title Cannot run with 8.2.0 Cannot run with Sphinx 8.2.0 Mar 2, 2025
@mgeier
Copy link
Member

mgeier commented Mar 2, 2025

There seem to be multiple issues, also involving 3rd party modules. For now, I'm planning to not support Sphinx 8.2 right now: #828.

@AA-Turner
Copy link

Sphinx 8.2.2 includes a temporary work-around for this issue, but the correct fix is to use explicit imports rather than implicit. Sorry that it took a few days, the approach to solve the regression only occured to me recently.

A

@AA-Turner
Copy link

AA-Turner commented Mar 2, 2025

There seem to be multiple issues, also involving 3rd party modules.

Please report any remaining/outstanding regressions to Sphinx, as I've tried to fix all the ones I have seen so far.

ethanwhite added a commit to ethanwhite/DeepForest that referenced this issue Mar 3, 2025
We had temporarily limited the sphinx version due to compatibility issues
with nbsphinx. These issues have been addressed upstream, so we can return
to using the most recent version.

See: spatialaudio/nbsphinx#825 (comment)
@mgeier
Copy link
Member

mgeier commented Mar 3, 2025

Thanks @AA-Turner for the work-around!

the correct fix is to use explicit imports rather than implicit.

Yeah, this will happen in #827. This is the easiest of all the recent problems.

Please report any remaining/outstanding regressions to Sphinx

I think there are no more unreported issues left.

Currently, there is still a warning from felix-hilden/sphinx-codeautolink#173 and the problem reported in sphinx-doc/sphinx#13346 (with your partial fix #822) is still waiting to be resolved.

jenshnielsen added a commit to jenshnielsen/nbsphinx that referenced this issue Mar 4, 2025
Closes spatialaudio#825

Implicit imports (imports that rely on the fact
that importing a module imports another module
such as a submodule) makes the code vulnerable
to breakage due to refactors in the dependent
code. Such as the changes in Sphinx 8.2.0 that
caused spatialaudio#825

This replaces all implicit imports that I
could find by explicit imports.
@jenshnielsen
Copy link
Contributor

@mgeier note that in addition to the issue in sphinx-codeautolink there is also missinglinkelectronics/sphinxcontrib-svg2pdfconverter#26 which is triggered by nbsphinx ci. See old comments in #826 The fix is simple and I have submitted a pr for that missinglinkelectronics/sphinxcontrib-svg2pdfconverter#27

Both the issues in sphinxcontrib-svg2pdfconverter and sphinx-codeautolink however don't really prevent using nbsphinx with sphinx 8.2 since none of them are requirements of nbsphinx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants