mcastorina / graph-cli

Flexible command line tool to create graphs from CSV data
782 stars 30 forks source link

failed to import any qt binding #24

Open zachvalenta opened 5 years ago

zachvalenta commented 5 years ago

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 commented 3 years ago

I have the same issue with Python 3.8

DamienCassou commented 3 years ago

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 commented 3 years ago

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

DamienCassou commented 3 years ago

@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 commented 1 year ago

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 :)