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

Matplotlib QT backend imports not working on MacOS #45398

Closed
1 of 2 tasks
ChrFr opened this issue Oct 5, 2021 · 4 comments
Closed
1 of 2 tasks

Matplotlib QT backend imports not working on MacOS #45398

ChrFr opened this issue Oct 5, 2021 · 4 comments
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers macOS stale Uh oh! Seems this work is abandoned, and the PR is about to close.

Comments

@ChrFr
Copy link

ChrFr commented Oct 5, 2021

What is the bug or the crash?

The imports from the matplotlib QT backend are not working on MacOS (e.g. FigureCanvasQTAgg_ or NavigationToolbar2QT from matplotlib.backends.backend_qt5agg ). I use those classes in a plugin to draw diagrams on a canvas.
The imports work fine in the Windows versions though.

There seems to be a library missing in the recent MacOS versions (?)

from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
Traceback (most recent call last):
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/backends/backend_qt5agg.py", line 10, in <module>
    from .backend_agg import FigureCanvasAgg
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/backends/backend_agg.py", line 35, in <module>
    from PIL import Image
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/Image.py", line 94, in <module>
    from . import _imaging as core
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: dlopen(/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so, 2): Library not loaded: /opt/X11/lib/libxcb.1.dylib
  Referenced from: /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so
  Reason: image not found

Steps to reproduce the issue

  1. Python console in QGIS (MacOS)
  2. type: from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg

Versions

QGIS-Version 3.16.11-Hannover QGIS-Codeversion 26cc1c7
Kompiliert gegen Qt 5.14.2 Laufendes Qt 5.14.2
Kompiliert mit GDAL/OGR 3.2.1 Läuft mit GDAL/OGR 3.2.1
Kompiliert mit GEOS 3.9.1-CAPI-1.14.2 Läuft mit GEOS 3.9.1-CAPI-1.14.2
Kompiliert mit SQLite 3.31.1 Läuft mit SQLite 3.31.1
PostgreSQL-Client-Version 12.3 SpatiaLite-Version 4.3.0a
QWT-Version 6.1.4 QScintilla2-Version 2.11.4
Kompiliert mit PROJ 6.3.2 Läuft mit PROJ Rel. 6.3.2, May 1st, 2020
BS-Version macOS 10.15
Aktive Python-Erweiterungen QuickOSM; quick_map_services; nominatim; mmqgis; processing; db_manager; MetaSearch

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

No response

@ChrFr ChrFr added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Oct 5, 2021
@PeterPetrik PeterPetrik self-assigned this Oct 5, 2021
@PeterPetrik
Copy link
Contributor

Hi @ChrFr thank you for your bug-report. Could you please download nightly build https://qgis.org/downloads/macos/nightly/qgis_nightly_master_20211004_123226.dmg and let me know if the issue still persists?

also could you please run command in terminal and submit me here the output?

otool -L /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so

@PeterPetrik PeterPetrik added the Feedback Waiting on the submitter for answers label Oct 5, 2021
@ChrFr
Copy link
Author

ChrFr commented Oct 5, 2021

Hi @PeterPetrik,

thank you for the fast response! The imports work with the linked nightly build 👍.

the output of the otool command:

/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so:
@rpath/libjpeg.9.dylib (compatibility version 14.0.0, current version 14.0.0)
@rpath/libopenjp2.7.dylib (compatibility version 7.0.0, current version 2.3.1)
@rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
@rpath/libtiff.5.dylib (compatibility version 11.0.0, current version 11.0.0)
/opt/X11/lib/libxcb.1.dylib (compatibility version 3.0.0, current version 3.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)

thanks

@github-actions
Copy link

The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale".
If you would like to continue with this issue, please provide any missing information or answer any open questions. If you could resolve the issue yourself meanwhile, please leave a note for future readers with the same problem and close the issue.
In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this issue.
If there is no further activity on this issue, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Oct 20, 2021
@github-actions
Copy link

While we hate to see this happen, this issue has been automatically closed because it has not had any activity in the last 42 days despite being marked as feedback. If this issue should be reconsidered, please follow the guidelines in the previous comment and reopen this issue.
Or, if you have any further questions, there are also further support channels that can help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers macOS stale Uh oh! Seems this work is abandoned, and the PR is about to close.
Projects
None yet
Development

No branches or pull requests

2 participants