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

Building docs with python >= 3.10 and sphinx < 2 fails #496

Closed
phantom-duck opened this issue Sep 29, 2023 · 2 comments · Fixed by #512
Closed

Building docs with python >= 3.10 and sphinx < 2 fails #496

phantom-duck opened this issue Sep 29, 2023 · 2 comments · Fixed by #512

Comments

@phantom-duck
Copy link
Contributor

Building the docs currently fails, because python versions >=3.10 and the requirement sphinx<2 in setup.py are incompatible. In those old versions of sphinx, and specifically in sphinx/ext/napoleon/docstring.py, the component collections.Callable is used. However, this has been moved to collections.abc since python 3.3, and removed altogether from collections since python 3.10 (sources: stackoverflow, python docs 1, github issue, python docs 2)

Steps to reproduce:

git clone https://github.com/Trusted-AI/AIF360.git
conda create -n aif360 python>=3.10
conda activate aif360
cd AIF360
pip install -e '.[all]'
cd docs
make html

The last command fails with error:

Exception occurred:
  File "path\to\sphinx\ext\napoleon\docstring.py", line 123, in __init__
    elif isinstance(obj, collections.Callable):  # type: ignore
                         ^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Callable'

I am not sure whether this is an appropriate issue for here or it would be better suited in sphinx, since sphinx itself does not specify an upper bound on the python version. Please let me know.

@PaarthShah
Copy link

I thought I was having the same problem (even cited this issue). However, it turned out to be completely resolved by installing the newest sphinx version: currently this repo is pinned to a much older one:

sphinx==1.8.6

@phantom-duck phantom-duck changed the title Building docs with python >= 3.10 fails Building docs with python >= 3.10 and sphinx < 2 fails Oct 1, 2023
@phantom-duck
Copy link
Contributor Author

phantom-duck commented Oct 1, 2023

Thank you, I should have made it more clear that the problem is not sphinx per se, but only that its version is very old. I have changed the title of the current issue to more clearly reflect this.

My suggestion would also be to update the version of sphinx to a newer one; keeping in mind, though, that I do not know why the version was pinned as such to begin with, so maybe other things will break? It is worth a shot, in my opinion.

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

Successfully merging a pull request may close this issue.

2 participants