mcastorina/graph-cli

Failed to import any qt binding

majkinetor opened this issue · 8 comments

> graph avocado.csv -y 2 --resample 2W

Traceback (most recent call last):
  File "c:\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python36\Scripts\graph.exe\__main__.py", line 9, in <module>
  File "c:\python36\lib\site-packages\graph_cli\main.py", line 17, in main
    create_graph(graphs)
  File "c:\python36\lib\site-packages\graph_cli\graph.py", line 218, in create_graph
    import matplotlib.pyplot as plt
  File "c:\python36\lib\site-packages\matplotlib\pyplot.py", line 2374, in <module>
    switch_backend(rcParams["backend"])
  File "c:\python36\lib\site-packages\matplotlib\pyplot.py", line 207, in switch_backend
    backend_mod = importlib.import_module(backend_name)
  File "c:\python36\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "c:\python36\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 5, in <module>
    from .backend_qt5agg import (
  File "c:\python36\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 11, in <module>
    from .backend_qt5 import (
  File "c:\python36\lib\site-packages\matplotlib\backends\backend_qt5.py", line 15, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "c:\python36\lib\site-packages\matplotlib\backends\qt_editor\figureoptions.py", line 13, in <module>
    import matplotlib.backends.qt_editor.formlayout as formlayout
  File "c:\python36\lib\site-packages\matplotlib\backends\qt_editor\formlayout.py", line 49, in <module>
    from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
  File "c:\python36\lib\site-packages\matplotlib\backends\qt_compat.py", line 165, in <module>
    raise ImportError("Failed to import any qt binding")
ImportError: Failed to import any qt binding

pip install PyQt5 fixed it.

Should be documented.

Thanks for the feedback.

I will add PyQt5 as a dependency in pip.

adding PyQt5 breaks the pip install on ubuntu (all major versions):

  Downloading matplotlib-2.2.4-cp27-cp27mu-manylinux1_x86_64.whl (12.8 MB)
ERROR: Could not find a version that satisfies the requirement PyQt5 (from graph-cli) (from versions: none)
ERROR: No matching distribution found for PyQt5 (from graph-cli)

Also Graph-CLI is not available on python3 (where as python 2.7 has been deprecated since january 2020

tried the same run on MacOs

Collecting matplotlib
  Downloading matplotlib-2.2.4-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (14.0 MB)
ERROR: Could not find a version that satisfies the requirement PyQt5 (from graph-cli) (from versions: none)
ERROR: No matching distribution found for PyQt5 (from graph-cli)

I have to add... I am using Azure DevOps with Microsoft hosted agent Pool.

Thanks for catching that. I just debugged in a docker image of ubuntu, and removing the PyQt5 dependency from pip fixes it. It seems to be working fine without the library.

I just pushed version 0.1.4 which includes the fix.

Pasting a pip freeze for reference.

root@89377ab94511:/graph-cli# python3 -m pip freeze
asn1crypto==0.24.0
cryptography==2.1.4
cycler==0.10.0
graph-cli==0.1.3
idna==2.6
keyring==10.6.0
keyrings.alt==3.0
kiwisolver==1.1.0
matplotlib==3.2.0rc1
numpy==1.18.1
pandas==1.0.0
pycrypto==2.6.1
pygobject==3.26.1
pyparsing==2.4.6
python-dateutil==2.8.1
pytz==2019.3
pyxdg==0.25
SecretStorage==2.3.1
six==1.11.0

Also, it should be available in python3. Maybe the issue is related to Azure?

$ python3 -m pip search graph-cli | grep graph-cli
graph-cli (0.1.3)                     - A CLI utility to create graphs from CSV files.

Once I am back home I will test it on Azure DevOps on multiple OSes.

Oke, it installs now... but somehow on the hosted Microsoft agents Graph is not doing anything (this is not due to graph I think but more Azure Devops. BTW On both OS it installs.

I think you can close the issue

Great, thanks for testing!

As for the issue with graph not doing anything.. have you tried using -o output.png to write the image to a file instead of displaying? Hope you get it working, and feel free to open another issue if needed.