Bug 1958886 - python-matplotlib fails to build with Python 3.10: ImportWarning: gi.importer.DynamicImporter.find_spec() not found; falling back to find_module() (treated as error in tests)
Summary: python-matplotlib fails to build with Python 3.10: ImportWarning: gi.importer...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-matplotlib
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Elliott Sales de Andrade
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1958890
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2021-05-10 11:29 UTC by Miro Hrončok
Modified: 2021-06-04 20:28 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-06-04 20:28:56 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Miro Hrončok 2021-05-10 11:29:20 UTC
python-matplotlib fails to build with Python 3.10.0b1.

__________________________________ test_fork ___________________________________
[gw0] linux -- Python 3.10.0 /usr/bin/python3

name = '_winapi', path = None, target = None

>   ???
E   AttributeError: 'DynamicImporter' object has no attribute 'find_spec'

<frozen importlib._bootstrap>:939: AttributeError

During handling of the above exception, another exception occurred:

    @pytest.mark.skipif(not hasattr(os, "register_at_fork"),
                        reason="Cannot register at_fork handlers")
    def test_fork():
        _model_handler(0)  # Make sure the font cache is filled.
        ctx = multiprocessing.get_context("fork")
>       with ctx.Pool(processes=2) as pool:

../../BUILDROOT/python-matplotlib-3.4.2-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/tests/test_font_manager.py:205: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.10/multiprocessing/context.py:118: in Pool
    from .pool import Pool
/usr/lib64/python3.10/multiprocessing/pool.py:30: in <module>
    from .connection import wait
/usr/lib64/python3.10/multiprocessing/connection.py:30: in <module>
    import _winapi
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1002: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:941: in _find_spec
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

finder = <gi.importer.DynamicImporter object at 0x7f1f229569e0>
name = '_winapi', path = None

>   ???
E   ImportWarning: DynamicImporter.find_spec() not found; falling back to find_module()

<frozen importlib._bootstrap>:914: ImportWarning
...
FAILED test_font_manager.py::test_fork - ImportWarning: DynamicImporter.find_...
FAILED test_figure.py::test_savefig_backend - ImportWarning: DynamicImporter....
FAILED test_image.py::test_load_from_url - ImportWarning: DynamicImporter.fin...
FAILED test_style.py::test_use_url - ImportWarning: DynamicImporter.find_spec...
= 4 failed, 7858 passed, 181 skipped, 13 xfailed, 5 xpassed in 608.08s (0:10:08) =



This problematic code is in pygobject, but matplotlib might be fixed by not treating this warning as error.



https://docs.python.org/3.10/whatsnew/3.10.html#deprecated

"""Starting in this release, there will be a concerted effort to begin cleaning up old import semantics that were kept for Python 2.7 compatibility. Specifically, find_loader()/find_module() (superseded by find_spec()), load_module() (superseded by exec_module()), module_repr() (which the import system takes care of for you), the __package__ attribute (superseded by __spec__.parent), the __loader__ attribute (superseded by __spec__.loader), and the __cached__ attribute (superseded by __spec__.cached) will slowly be removed (as well as other classes and methods in importlib). ImportWarning and/or DeprecationWarning will be raised as appropriate to help identify code which needs updating during this transition."""

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/02173524-python-matplotlib/

For all our attempts to build python-matplotlib with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-matplotlib/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro Hrončok 2021-06-04 20:13:12 UTC
This is a mass-posted update. Sorry if it is not 100% accurate to this bugzilla.


The Python 3.10 rebuild is in progress in a Koji side tag. If you manage to fix the problem, please commit the fix in the rawhide branch, but don't build the package in regular rawhide.

You can either build the package in the side tag, with:

    $ fedpkg build --target=f35-python

Or you can the build and we will eventually build it for you.

Note that the rebuild is still in progress, so not all (build) dependencies of this package might be available right away.

Thanks.

See also https://fedoraproject.org/wiki/Changes/Python3.10

If you have general questions about the rebuild, please use this mailing list thread: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/G47SGOYIQLRDTWGOSLSWERZSSHXDEDH5/

Comment 2 Elliott Sales de Andrade 2021-06-04 20:28:56 UTC
Fixed by the linked bug report.


Note You need to log in before you can comment on or make changes to this bug.