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

failed to import any qt binding #24

Open
zachvalenta opened this issue Jul 3, 2019 · 5 comments
Open

failed to import any qt binding #24

zachvalenta opened this issue Jul 3, 2019 · 5 comments
Labels
bug Something isn't working

Comments

@zachvalenta
Copy link

Seems like the same phenomenon as #22.

(venv) $ graph samples/bar.csv --bar
Traceback (most recent call last):
  File "/Users/zach/Desktop/graph-cli/venv/bin/graph", line 10, in <module>
    sys.exit(main.main())
  File "/Users/zach/Desktop/graph-cli/venv/lib/python3.6/site-packages/graph_cli/main.py", line 17, in main
    create_graph(graphs)
  File "/Users/zach/Desktop/graph-cli/venv/lib/python3.6/site-packages/graph_cli/graph.py", line 218, in create_graph
    import matplotlib.pyplot as plt
  File "/Users/zach/Desktop/graph-cli/venv/lib/python3.6/site-packages/matplotlib/pyplot.py", line 2355, in <module>
    switch_backend(rcParams["backend"])
  File "/Users/zach/Desktop/graph-cli/venv/lib/python3.6/site-packages/matplotlib/pyplot.py", line 221, in switch_backend
    backend_mod = importlib.import_module(backend_name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Users/zach/Desktop/graph-cli/venv/lib/python3.6/site-packages/matplotlib/backends/backend_qt4agg.py", line 5, in <module>
    from .backend_qt5agg import (
  File "/Users/zach/Desktop/graph-cli/venv/lib/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py", line 11, in <module>
    from .backend_qt5 import (
  File "/Users/zach/Desktop/graph-cli/venv/lib/python3.6/site-packages/matplotlib/backends/backend_qt5.py", line 15, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "/Users/zach/Desktop/graph-cli/venv/lib/python3.6/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 13, in <module>
    from matplotlib.backends.qt_compat import QtGui
  File "/Users/zach/Desktop/graph-cli/venv/lib/python3.6/site-packages/matplotlib/backends/qt_compat.py", line 158, in <module>
    raise ImportError("Failed to import any qt binding")
ImportError: Failed to import any qt binding

(venv) $ python --version
Python 3.6.1
@DamienCassou
Copy link

I have the same issue with Python 3.8

@DamienCassou
Copy link

Here is a trace:

Traceback (most recent call last):
  File "/pypi/graph-cli-0.1.17/bin/.graph-wrapped", line 9, in <module>
    sys.exit(main.main())
  File "/pypi/graph-cli-0.1.17/lib/python3.8/site-packages/graph_cli/main.py", line 17, in main
    create_graph(graphs)
  File "/pypi/graph-cli-0.1.17/lib/python3.8/site-packages/graph_cli/graph.py", line 241, in create_graph
    import matplotlib.pyplot as plt
  File "/pypi/python3.8-matplotlib-3.4.2/lib/python3.8/site-packages/matplotlib/pyplot.py", line 2500, in <module>
    switch_backend(rcParams["backend"])
  File "/pypi/python3.8-matplotlib-3.4.2/lib/python3.8/site-packages/matplotlib/pyplot.py", line 277, in switch_backend
    class backend_mod(matplotlib.backend_bases._Backend):
  File "/pypi/python3.8-matplotlib-3.4.2/lib/python3.8/site-packages/matplotlib/pyplot.py", line 278, in backend_mod
    locals().update(vars(importlib.import_module(backend_name)))
  File "/pyti/python3-3.8.11/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/pypi/python3.8-matplotlib-3.4.2/lib/python3.8/site-packages/matplotlib/backends/backend_qt5agg.py", line 11, in <module>
    from .backend_qt5 import (
  File "/pypi/python3.8-matplotlib-3.4.2/lib/python3.8/site-packages/matplotlib/backends/backend_qt5.py", line 13, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "/pypi/python3.8-matplotlib-3.4.2/lib/python3.8/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 11, in <module>
    from matplotlib.backends.qt_compat import QtGui
  File "/pypi/python3.8-matplotlib-3.4.2/lib/python3.8/site-packages/matplotlib/backends/qt_compat.py", line 179, in <module>
    raise ImportError("Failed to import any qt binding")
ImportError: Failed to import any qt binding

@mcastorina
Copy link
Owner

I'm looking into how to resolve this. Have you tried installing PyQt5 ?

@mcastorina mcastorina added the bug Something isn't working label Oct 12, 2021
@DamienCassou
Copy link

@mcastorina: when I add PyQt5 I get:

qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Aborted (core dumped)

@ag91
Copy link

ag91 commented Feb 22, 2023

I fell into this as well XD
I suspect that M1 Mac users will see this (at least more often): https://stackoverflow.com/questions/70936664/metadata-generation-failed-while-installing-pyqt5

Apparently for that architecture you just need to hide your pyqt5 behind the building magic of homebrew, which takes care of Python 3 issues with the M1 architecture.

So install python3 with brew and then run:
brew install pyqt5

Probably this has nothing to do with @mcastorina great work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants