GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DOC: Spin docs gives errors (distutils) on new codespaces (because python 3.12 in environment.yml) · Issue #29131 · numpy/numpy

DOC: Spin docs gives errors (distutils) on new codespaces (because python 3.12 in environment.yml) #29131

New issue
Copy link
New issue
Copy link
Closed
#29160
Closed
DOC: Spin docs gives errors (distutils) on new codespaces (because python 3.12 in environment.yml)#29131
#29160
Copy link
Labels
04 - Documentation

Description

@bmwoodruff
bmwoodruff
opened on Jun 5, 2025
Issue body actions

Issue with current documentation:

With SciPy 2025 coming up, and the possibility of having new people join for sprints, i figured it would be worth pointing out a possible hiccup.

  • When building the docs from a fresh codespaces environment (or new conda environment using environment.yml), the command spin docs finishes with error messages. This are the same numpy.distutils error message discussed in DOC: docs build warnings #28694.

The issue occurs because of the pinned 3.12 python version.

numpy/environment.yml

Line 10 in c6eed9a

- python=3.12 # need to pin to avoid issues with builds

Idea or request for content:

The issue disappears by manually changing the python version back to 3.11. These steps should error free build the docs on codespaces.

  1. Make a branch
  2. Change 3.12 to 3.11 in environment.yml and push the changes to your branch.
  3. Create a codespaces on GitHub for the new branch.
  4. conda activate numpy-dev
  5. spin test && pip install -r requirements/doc_requirements.txt && spin docs

My hope is this could help anyone new who wants to help but can't figure out why they keep getting errors. Maybe there is a simpler way to help someone new that doesn't involve changing environment.yml.

Activity

  1. bmwoodruff
    added
    04 - Documentation
    on Jun 5, 2025
  2. bmwoodruff
    changed the title [-]DOC: Spin docs gives errors (distutils) on new codespaces (because python 3.12 in environment.yaml)[/-] [+]DOC: Spin docs gives errors (distutils) on new codespaces (because python 3.12 in environment.yml)[/+] on Jun 5, 2025
  3. charris commented on Jun 5, 2025

    @charris
    charris
    on Jun 5, 2025
    Member
    More actions

    It seems reasonable to pin to the lowest supported numpy version, want to make a PR?

    I wonder why it was pinned to 3.12?

  4. bmwoodruff commented on Jun 5, 2025

    @bmwoodruff
    bmwoodruff
    on Jun 5, 2025
    MemberAuthor
    More actions

    The change was made in 8a890f1, but not sure what issues where happening with builds.

    Any thoughts @rgommers on moving it back to 3.11 for the time being at least till after SciPy? I haven't experienced any issues on codespaces, ubuntu 24, nor a virtual machinie of ubuntu on windows after changing it to 3.11, but I haven't tested macos (which seems connected to the commit above).

    I can submit a PR to revert the change in environment.yml, but I'm not sure the macos.yml needs reverting, nor am I sure if the two differences will cause issues. I'll wait for more feedback.

  5. rgommers commented on Jun 6, 2025

    @rgommers
    rgommers
    on Jun 6, 2025
    Member
    More actions

    but I haven't tested macos (which seems connected to the commit above).

    Indeed. Following back the trail from that commit, it leads to these comments about a flaky test and having to move to 3.12 to resolve them: #27550 (comment)

    This problem isn't specific to environment.yml but will show up for pretty much any way new contributors will set up their environment, since it's unlikely they'll get Python 3.11 in that environment. Hence, if we want to fix the warnings rather than live with them for another 6 months, it'd be better to do it by starting to remove some references (that has to be done anyway) and gating the rest behind an .. only:: py311 directive (see https://sublime-and-sphinx-guide.readthedocs.io/en/latest/conditions.html#use-conditional-text), with the py311 tag set in doc/Makefile.

    WDYT?

    Reacted by Melissa Weber Mendonça
  6. bmwoodruff commented on Jun 6, 2025

    @bmwoodruff
    bmwoodruff
    on Jun 6, 2025
    MemberAuthor
    More actions

    it'd be better to do it by starting to remove some references (that has to be done anyway) and gating the rest behind an .. only:: py311 directive

    Sounds like a fun project to work on. Do you have an example of a reference that needs to be removed and one that needs to be gated behind a directive? I have time to go through and update all of them.

  7. ngoldbaum commented on Jun 6, 2025

    @ngoldbaum
    ngoldbaum
    on Jun 6, 2025
    Member
    More actions

    Sounds like a fun project to work on. Do you have an example of a reference that needs to be removed and one that needs to be gated behind a directive? I have time to go through and update all of them.

    I think you'd have to figure that out by repeatedly building the docs in a Python 3.12 or 3.13 environment and adding the only directives until the docs build is clean.

    Reacted by Ben Woodruff
  8. bmwoodruff commented on Jun 7, 2025

    @bmwoodruff
    bmwoodruff
    on Jun 7, 2025
    MemberAuthor
    More actions

    Here is a progress update.

    The main problem is the following:

    numpy/doc/source/reference/distutils/misc_util.rst

    Lines 4 to 7 in 031f442

    .. automodule:: numpy.distutils.misc_util
    :members:
    :undoc-members:
    :exclude-members: Configuration

    Once this automodule section is removed, then WARNING: Failed to import numpy.distutils.misc_util disappears entirely when building the docs with python 3.12. However, then 4 new warnings appear (labels added to reference later).

    reading sources... [100%] user/whatisnumpy
    (1) /../numpy/doc/source/reference/index.rst:39: WARNING: toctree contains reference to excluded document 'reference/distutils'
    (2) /../numpy/doc/source/reference/module_structure.rst:55: WARNING: toctree contains reference to excluded document 'reference/distutils'
    looking for now-outdated files... none found
    pickling environment... done
    (3) checking consistency... /../numpy/doc/source/reference/distutils/misc_util.rst: WARNING: document isn't included in any toctree
    done
    preparing documents... done
    copying assets... copying static files... done
    copying extra files... done
    done
    writing output... [100%] user/whatisnumpy
    (4) /../numpy/doc/source/reference/module_structure.rst:47: WARNING: undefined label: 'numpy-distutils-refguide'
    generating indices... genindex done

    Here are the corresponding lines of code that generate these warnings.

    numpy/doc/source/reference/index.rst

    Line 43 in 031f442

    distutils

    numpy/doc/source/reference/module_structure.rst

    Line 47 in 031f442

    - :ref:`numpy.distutils <numpy-distutils-refguide>` (deprecated) - build system support

    numpy/doc/source/reference/module_structure.rst

    Line 73 in 031f442

    numpy.distutils <distutils>

    Warnings 1,2, and 4 above can all be dealt with by removing the corresponding reference/label. I'm still working on how to remove warning 3 above in a way that allows the build to work with both python 3.11 and >=3.12.

  9. bmwoodruff commented on Jun 7, 2025

    @bmwoodruff
    bmwoodruff
    on Jun 7, 2025
    MemberAuthor
    More actions

    Looks like adding :orphan: to the top of the page may be all that's needed. Hopefully I'll a PR ready soon. Thanks for the suggestions on how to fix the docs build issue.

    Reacted by Melissa Weber Mendonça
  10. bmwoodruff commented on Jun 9, 2025

    @bmwoodruff
    bmwoodruff
    on Jun 9, 2025
    MemberAuthor
    More actions

    A cleaner way of excluding this orphaned file is to update conf.py from

    numpy/doc/source/conf.py

    Lines 153 to 154 in 75fd1ff

    if sys.version_info[:2] >= (3, 12):
    exclude_patterns += ["reference/distutils.rst"]

    to

    if sys.version_info[:2] >= (3, 12):
        exclude_patterns += [
            "reference/distutils.rst",
            "reference/distutils/misc_util.rst",
        ]
    

    This solves the import warning errors and keeps the exclusions in the same place for simple removal later.

    Updating the toctree is more complicated. The only directive (and ifconfig) both apply AFTER a toctree is built. I couldn't use the .. only:: py311 directive to stop automodule for the same reason. Content will be excluded using only or ifconfig, but the toctree still looks for all related content before conditionals are applied. As such, using .. only:: py311 doesn't prevent WARNING: toctree contains reference to excluded document 'reference/distutils' from appearing.

    After searching for solutions, this is apparently a known issue that some of you have encountered before (see #16372 (comment)). Anyone have any experience with using only to deal with toctrees and references?

    Right now I'm playing around with nitpick_ignore. I have an option that builds the docs without warnings, but requires suppress_warnings += ['toc.excluded'] as you cannot use nitpick to supress toctree warnings (or I just don't know how). I'm not fully happy with this solution, and would love to discuss it more.

    I'm going to submit a draft PR and we can move the conversation over there.

  11. bmwoodruff
    added a commit that references this issue on Jun 9, 2025

    DOC: Suppress distutils doc build warnings for python 3.12+

    This issue will close once commit b2e37ad is merged into the 'main' branch.
    b2e37ad
  12. rgommers commented on Jun 10, 2025

    @rgommers
    rgommers
    on Jun 10, 2025
    Member
    More actions

    Thanks for working through the options for avoiding the warnings @bmwoodruff!

    Reacted by Ben Woodruff
  13. charris
    closed this as completedin #29160on Jun 13, 2025
  14. charris
    added a commit that references this issue on Jun 13, 2025

    DOC: Suppress distutils doc build warnings for python 3.12+ (#29160)

    This issue will close once commit 79deb8f is merged into the 'main' branch.
    79deb8f
  15. joy2myself
    added a commit that references this issue on Jul 21, 2025

    ENH: Convert unary from C universal intrinsics to C++ using Highway (#19

    This issue will close once commit 3f5dccf is merged into the 'rvv' branch.
    3f5dccf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    04 - Documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.