• DepthAI-v2
  • Error displaying Pipeline with pipeline_graph

Hi folks,

I just found out about the pipeline_graph, this could help me debug some things.

After following the instructions I tried as an example:

pipeline_graph run "python3 /Users/lasse/depthai-python/examples/ColorCamera/rgb_camera_control.py"

and ran into this error:

Pipeline schema retrieved
Program exited.
Traceback (most recent call last):

File "/Users/lasse/miniconda3/envs/oak/bin/pipeline_graph", line 8, in <module>

sys.exit(main())

^^^^^^

File "/Users/lasse/miniconda3/envs/oak/lib/python3.11/site-packages/depthai_pipeline_graph/pipeline_graph.py", line 375, in main

p.cmd_tool(args)

File "/Users/lasse/miniconda3/envs/oak/lib/python3.11/site-packages/depthai_pipeline_graph/pipeline_graph.py", line 221, in cmd_tool

self.create_graph(schema)

File "/Users/lasse/miniconda3/envs/oak/lib/python3.11/site-packages/depthai_pipeline_graph/pipeline_graph.py", line 267, in create_graph

qt_node = self.graph.create_node('dai.DepthaiNode',

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Users/lasse/miniconda3/envs/oak/lib/python3.11/site-packages/depthai_pipeline_graph/NodeGraphQt/base/graph.py", line 922, in create_node

node = self._node_factory.create_node_instance(node_type)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Users/lasse/miniconda3/envs/oak/lib/python3.11/site-packages/depthai_pipeline_graph/NodeGraphQt/base/factory.py", line 61, in create_node_instance

return _NodeClass()

^^^^^^^^^^^^

File "/Users/lasse/miniconda3/envs/oak/lib/python3.11/site-packages/depthai_pipeline_graph/pipeline_graph.py", line 24, in init

super(DepthaiNode, self).init()

File "/Users/lasse/miniconda3/envs/oak/lib/python3.11/site-packages/depthai_pipeline_graph/NodeGraphQt/nodes/base_node.py", line 65, in init

super(BaseNode, self).init(qgraphics_views)

File "/Users/lasse/miniconda3/envs/oak/lib/python3.11/site-packages/depthai_pipeline_graph/NodeGraphQt/base/node.py", line 73, in init

self._view = _NodeItem()

^^^^^^^^^^^

File "/Users/lasse/miniconda3/envs/oak/lib/python3.11/site-packages/depthai_pipeline_graph/NodeGraphQt/qgraphics/node_base.py", line 31, in init

super(NodeItem, self).init(name, parent)

File "/Users/lasse/miniconda3/envs/oak/lib/python3.11/site-packages/depthai_pipeline_graph/NodeGraphQt/qgraphics/node_abstract.py", line 14, in init

self.setFlags(self.ItemIsSelectable | self.ItemIsMovable)

TypeError: 'PySide2.QtWidgets.QGraphicsItem.GraphicsItemFlag' object cannot be interpreted as an integer

Any thoughts on how I could precede?

  • jakaskerl replied to this.
  • I'm pleased to say that I've solved my problem and pipelinegraph is now working for me. 😁 Initially it was my syntax error when invoking pipeline_graph (not any x32bit apps) but fixing that led to a cv2 module not found error despite cv2 being installed correctly. The problem was having no PYTHONPATH and my virtual environment site-applications directory was not listed in sys.path. Immediately that was addressed it worked.

    Hi @lasse
    Looks like a wrong pyside version. Could you list out the installed packages please?

    Thanks,
    Jaka

    Here the list:

    Package                Version
    ---------------------- ----------
    blobconverter          1.4.2
    boto3                  1.34.19
    botocore               1.34.19
    certifi                2023.11.17
    charset-normalizer     3.3.2
    depthai                2.24.0.0
    depthai-pipeline-graph 0.0.5
    depthai-sdk            1.12.0
    filelock               3.13.3
    fsspec                 2024.3.1
    idna                   3.6
    Jinja2                 3.1.3
    jmespath               1.0.1
    MarkupSafe             2.1.5
    marshmallow            3.17.0
    mpmath                 1.3.0
    networkx               3.3
    numpy                  1.26.4
    onnx                   1.16.0
    opencv-contrib-python  4.5.5.62
    opencv-python          4.9.0.80
    packaging              23.2
    pillow                 10.3.0
    pip                    24.0
    protobuf               5.26.1
    psutil                 5.9.3
    PyQt5                  5.15.5
    PySide2                5.13.2
    PySimpleGUI            4.60.3
    python-dateutil        2.8.2
    pytube                 15.0.0
    PyTurboJPEG            1.6.4
    PyYAML                 6.0.1
    Qt.py                  1.3.8
    qtgui                  0.0.1
    requests               2.31.0
    s3transfer             0.10.0
    sentry-sdk             1.21.0
    setuptools             68.2.2
    shiboken2              5.13.2
    six                    1.16.0
    sympy                  1.12
    torch                  2.2.2
    torchvision            0.17.2
    types-pyside2          5.15.2.1.6
    typing_extensions      4.11.0
    urllib3                2.0.7
    wheel                  0.41.2
    xmltodict              0.13.0

    Thanks!

    Hi @lasse
    Try uninstalling pyside and see if the pipeline graph grabs pyqt5 instead.

    Thanks,
    Jaka

    Reinstalling the packages does not work… Same error

    How can I see if it grabs Pyqt5?

    Thanks Jaka for all of your help!

    Hi @lasse
    From the install page of the graph:

    If not already present, the command above will install the python module Qt.py. Qt.py enables you to write software that runs on any of the 4 supported bindings - PySide2, PyQt5, PySide and PyQt4. If none of these binding is installed, you will get an error message when running pipeline_graph

    You get an error that says:

    lasse File "/Users/lasse/miniconda3/envs/oak/lib/python3.11/site-packages/depthai_pipeline_graph/NodeGraphQt/qgraphics/node_abstract.py", line 14, in init

    self.setFlags(self.ItemIsSelectable | self.ItemIsMovable)

    TypeError: 'PySide2.QtWidgets.QGraphicsItem.GraphicsItemFlag' object cannot be interpreted as an integer

    This is why I suggested deleting pyside2 (not reinstalling), so the module grabs a different QT plugin.

    Thanks,
    Jaka

    I managed to get it to work.

    I had to uninstall PySide2, downgrade depthai to version 2.22.0 and reinstall pipeline_graph.

    Thank you very much, @jakaskerl !

    8 months later

    I can't get pipeline_graph working either. I'm getting a different error though (below).

    I'm using a PyCharm Python3.10 environment, so that I could install PySide2, and have tried a few scripts. They all give the same error. I can't find the relevant log or json files to see if that works.

    (.venv) PS C:\Users\regor\PycharmProject\My_Blazepose> pipeline_graph run Main.py

    Traceback (most recent call last):

    File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main

    return _run_code(code, main_globals, None,

    File "C:\Python310\lib\runpy.py", line 86, in _run_code

    exec(code, run_globals)

    File "C:\Users\regor\PycharmProject\My_Blazepose\.venv\Scripts\pipeline_graph.exe\main.py", line 7, in <module>

    File "C:\Users\regor\PycharmProject\My_Blazepose\.venv\lib\site-packages\depthai_pipeline_graph\pipeline_graph.py", line 375, in main

    p.cmd_tool(args)

    File "C:\Users\regor\PycharmProject\My_Blazepose\.venv\lib\site-packages\depthai_pipeline_graph\pipeline_graph.py", line 154, in cmd_tool

    self.process = subprocess.Popen(command, shell=False, text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

    File "C:\Python310\lib\subprocess.py", line 971, in init

    self._execute_child(args, executable, preexec_fn, close_fds,

    File "C:\Python310\lib\subprocess.py", line 1440, in _execute_child

    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

    OSError: [WinError 193] %1 is not a valid Win32 application

    Any thoughts how to fix?

    The error OSError: [WinError 193] %1 is not a valid Win32 application typically occurs when there is an attempt to execute a file that is not compatible with the current system or Python environment. This could mean:
    1. The file is not an executable or script for your system.
    2. There is a mix-up between 32-bit and 64-bit binaries or Python installations.
    3. The environment or the command is misconfigured.

    Verify Python Installation

    • Ensure that your Python installation matches the architecture of your system.
    • If you’re using a 64-bit Windows, make sure you have a 64-bit Python installed.
    • Run:
      python --version
      python -c "import platform; print(platform.architecture())"

    Verify that the output matches your system architecture (e.g., 64-bit).

    Thanks,
    Jaka

    I downloaded the 64 bit installer to install Python 3.10.

    Output of above bash code is: C:\Users\roger>python --version

    Python 3.10.10

    C:\Users\roger>python -c "import platform; print(platform.architecture())"

    ('64bit', 'WindowsPE')

    Python 3.10.10 is also reported as the python version output from my python 3.10 project environment directory

    depthai_pipeline_graph is installed only in that environment.

    pipeline_graph -h runs normally and displays the help information

    I have PySide2 and Qt.py installed. Qt.py was installed with depthai_pipeline_graph and I added PySide2 finally after downgrading to Python 3.10 and creating the new Python 3.10 environment. There are no other PySide or Qt modules installed.

    Could Qt.py or PySide2 be the source of the problem or is there are glitch in my Python 3.10 installation?

    I reinstalled Python with Python version 3.10.11 x64 bit and created a new Pycharm 3.10 environment with depthai-pipeline-graph, PySide2 and a simple rgbreview.py script using the Oak-D Lite. Initially with pipeline_graph -h a warning (below) was displayed before the help info.

    "A module that was compiled using NumPy 1.x cannot be run in NumPy 2.2.1 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'. If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2".

    I downgraded to numpy 1.26 and now again get 'OSError: [WinError 193] %1 is not a valid Win32 application' when trying to use 'pipeline_graph run rgbreview.py' but not with 'pipeline_graph -h'

    Perhaps I did not properly understand the information about numpy?

      regorWislon
      It looks like you have two different python versions - one 32bit and one 64bit. Probably the easiest thing to do is to create a new clean environment and install the required dependencies there.

      Thanks,
      Jaka

      I'm pleased to say that I've solved my problem and pipelinegraph is now working for me. 😁 Initially it was my syntax error when invoking pipeline_graph (not any x32bit apps) but fixing that led to a cv2 module not found error despite cv2 being installed correctly. The problem was having no PYTHONPATH and my virtual environment site-applications directory was not listed in sys.path. Immediately that was addressed it worked.

      a month later
      • Edited

      I am getting a similar error to @regorWislon

      line 154, in cmd_tool
      self.process = subprocess.Popen(command, shell=False, text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      OSError: [WinError 193] %1 is not a valid Win32 application

      I don't have issues with pythonpath, and the site applications directory is listed in sys.path. Not sure what is going on here.

        jsiic

        I resolved it with the help of ChatGPT. Had to change command so that it started with sys.executable instead of python. I am not sure how applicable this solution is for others but it worked!

        I am on windows.