Bug 1947295 - python-matplotlib fails to build with Python 3.10: AttributeError: 'VendorImporter' object has no attribute 'find_spec'
Summary: python-matplotlib fails to build with Python 3.10: AttributeError: 'VendorImp...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-matplotlib
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tomáš Hrnčiar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1941609
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2021-04-08 07:38 UTC by Tomáš Hrnčiar
Modified: 2021-04-27 07:21 UTC (History)
9 users (show)

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


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2021-04-08 07:38:44 UTC
python-matplotlib fails to build with Python 3.10.0a7.

=================================== FAILURES ===================================
_____________________________ test_savefig_backend _____________________________
[gw1] linux -- Python 3.10.0 /usr/bin/python3

name = '@absent', path = None, target = None

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

<frozen importlib._bootstrap>:933: AttributeError

During handling of the above exception, another exception occurred:

    def test_savefig_backend():
        fig = plt.figure()
        # Intentionally use an invalid module name.
        with pytest.raises(ModuleNotFoundError, match="No module named '@absent'"):
>           fig.savefig("test", backend="module://@absent")

../../BUILDROOT/python-matplotlib-3.4.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/tests/test_figure.py:496: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-matplotlib-3.4.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/figure.py:2962: in savefig
    self.canvas.print_figure(fname, **kwargs)
../../BUILDROOT/python-matplotlib-3.4.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/backend_bases.py:2186: in print_figure
    canvas = self._get_output_canvas(backend, format)
../../BUILDROOT/python-matplotlib-3.4.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/backend_bases.py:2101: in _get_output_canvas
    importlib.import_module(cbook._backend_module_name(backend))
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1044: in _gcd_import
    ???
<frozen importlib._bootstrap>:1021: in _find_and_load
    ???
<frozen importlib._bootstrap>:996: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _find_spec
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

finder = <pkg_resources.extern.VendorImporter object at 0x7f7769be6ad0>
name = '@absent', path = None

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

<frozen importlib._bootstrap>:908: ImportWarning
__________________________________ test_fork ___________________________________
[gw1] linux -- Python 3.10.0 /usr/bin/python3

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

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

<frozen importlib._bootstrap>:933: 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.1-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>:1021: in _find_and_load
    ???
<frozen importlib._bootstrap>:996: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _find_spec
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

finder = <pkg_resources.extern.VendorImporter object at 0x7f7769be6ad0>
name = '_winapi', path = None

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

<frozen importlib._bootstrap>:908: ImportWarning
______________________________ test_load_from_url ______________________________
[gw1] linux -- Python 3.10.0 /usr/bin/python3

name = 'winreg', path = None, target = None

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

<frozen importlib._bootstrap>:933: AttributeError

During handling of the above exception, another exception occurred:

    def test_load_from_url():
        path = Path(__file__).parent / "baseline_images/pngsuite/basn3p04.png"
        url = ('file:'
               + ('///' if sys.platform == 'win32' else '')
               + path.resolve().as_posix())
        with _api.suppress_matplotlib_deprecation_warning():
>           plt.imread(url)

../../BUILDROOT/python-matplotlib-3.4.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/tests/test_image.py:718: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-matplotlib-3.4.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/pyplot.py:2376: in imread
    return matplotlib.image.imread(fname, format)
../../BUILDROOT/python-matplotlib-3.4.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/image.py:1494: in imread
    with request.urlopen(fname, context=ssl_ctx) as response:
/usr/lib64/python3.10/urllib/request.py:216: in urlopen
    return opener.open(url, data, timeout)
/usr/lib64/python3.10/urllib/request.py:519: in open
    response = self._open(req, data)
/usr/lib64/python3.10/urllib/request.py:536: in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
/usr/lib64/python3.10/urllib/request.py:496: in _call_chain
    result = func(*args)
/usr/lib64/python3.10/urllib/request.py:1483: in file_open
    return self.open_local_file(req)
/usr/lib64/python3.10/urllib/request.py:1500: in open_local_file
    import mimetypes
/usr/lib64/python3.10/mimetypes.py:31: in <module>
    import winreg as _winreg
<frozen importlib._bootstrap>:1021: in _find_and_load
    ???
<frozen importlib._bootstrap>:996: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _find_spec
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

finder = <pkg_resources.extern.VendorImporter object at 0x7f7769be6ad0>
name = 'winreg', path = None

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

<frozen importlib._bootstrap>:908: ImportWarning
_________________________________ test_use_url _________________________________
[gw0] linux -- Python 3.10.0 /usr/bin/python3

name = 'winreg', path = None, target = None

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

<frozen importlib._bootstrap>:933: AttributeError

During handling of the above exception, another exception occurred:

tmpdir = local('/tmp/pytest-of-mockbuild/pytest-0/popen-gw0/test_use_url0')

    def test_use_url(tmpdir):
        path = Path(tmpdir, 'file')
        path.write_text('axes.facecolor: adeade')
        with temp_style('test', DUMMY_SETTINGS):
            url = ('file:'
                   + ('///' if sys.platform == 'win32' else '')
                   + path.resolve().as_posix())
>           with style.context(url):

../../BUILDROOT/python-matplotlib-3.4.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/tests/test_style.py:68: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.10/contextlib.py:133: in __enter__
    return next(self.gen)
../../BUILDROOT/python-matplotlib-3.4.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/style/core.py:154: in context
    use(style)
../../BUILDROOT/python-matplotlib-3.4.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/style/core.py:115: in use
    rc = rc_params_from_file(style, use_default_template=False)
../../BUILDROOT/python-matplotlib-3.4.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/__init__.py:799: in rc_params_from_file
    config_from_file = _rc_params_in_file(fname, fail_on_error=fail_on_error)
../../BUILDROOT/python-matplotlib-3.4.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/__init__.py:728: in _rc_params_in_file
    with _open_file_or_url(fname) as fd:
/usr/lib64/python3.10/contextlib.py:133: in __enter__
    return next(self.gen)
../../BUILDROOT/python-matplotlib-3.4.1-1.fc35.x86_64/usr/lib64/python3.10/site-packages/matplotlib/__init__.py:699: in _open_file_or_url
    with urllib.request.urlopen(fname, context=ssl_ctx) as f:
/usr/lib64/python3.10/urllib/request.py:216: in urlopen
    return opener.open(url, data, timeout)
/usr/lib64/python3.10/urllib/request.py:519: in open
    response = self._open(req, data)
/usr/lib64/python3.10/urllib/request.py:536: in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
/usr/lib64/python3.10/urllib/request.py:496: in _call_chain
    result = func(*args)
/usr/lib64/python3.10/urllib/request.py:1483: in file_open
    return self.open_local_file(req)
/usr/lib64/python3.10/urllib/request.py:1500: in open_local_file
    import mimetypes
/usr/lib64/python3.10/mimetypes.py:31: in <module>
    import winreg as _winreg
<frozen importlib._bootstrap>:1021: in _find_and_load
    ???
<frozen importlib._bootstrap>:996: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _find_spec
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

finder = <pkg_resources.extern.VendorImporter object at 0x7fa94c362770>
name = 'winreg', path = None

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

FAILED test_figure.py::test_savefig_backend - ImportWarning: VendorImporter.f...
FAILED test_font_manager.py::test_fork - ImportWarning: VendorImporter.find_s...
FAILED test_image.py::test_load_from_url - ImportWarning: VendorImporter.find...
FAILED test_style.py::test_use_url - ImportWarning: VendorImporter.find_spec(...
= 4 failed, 7840 passed, 180 skipped, 13 xfailed, 5 xpassed in 596.63s (0:09:56) =

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/02121711-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 Elliott Sales de Andrade 2021-04-08 08:24:06 UTC
I mean, I don't see how this is a matplotlib issue; it's clearly broken in Python.

Comment 2 Tomáš Hrnčiar 2021-04-08 08:41:55 UTC
Yes, you are right. Sorry for the noise. There is no need to take care of this from your side. I'll assign it to myself and keep it open for our tracking purposes.

Comment 3 Miro Hrončok 2021-04-08 09:22:57 UTC
This needs to be fixed in setuptools: https://github.com/pypa/setuptools/issues/2632


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