• DepthAI
  • Having issue for installation on RPi 4 B 4GB

Hello franva, so this means that opencv doesn't have prebuilt wheels for your host. I assume you are using RaspberryPi, so here are the supported python versions for the opencv:
https://www.piwheels.org/project/opencv-python/
I would suggest using python 3.7 or 3.9 (they come preinstalled with the buster/bullseye version of the RaspberryPi OS), so installing the library will just download the prebuilt library instead of trying (& failing) on building it. I hope this makes sense!
Thanks, Erik

    erik brilliant! There is the wheel already ! haha thanks a lot!

    For the opencv-contrib-python I found it here
    However, it does not have the same version 4.5.3.56 as for opencv-python.

    If I installed the older version opencv-contrib-python, will it cause issues?(I imagine they won't be compatible which is a big issue)
    Why do I still need opencv-contrib-python even after I installed opencv-python?

    Once again, thanks for your help.

    Cheers,

    Winston

    • erik replied to this.

      Hello franva, I actually think you could just use that version - the opencv-contrib only adds some extra functionalities, and I believe we use only the basic functions, which should be available in the mentioned version.
      Thanks, Erik

        thanks erik so "that version" means the version for opencv-python, right?

        And if I understood you correctly, I won't need the opencv-contrib-python right?
        It would be a great relief if I didn't need to install one more hard-to-install package haha.

        Thanks
        Winston

        • erik replied to this.

          My bad franva for not being clear; I meant that you could try using python version 3.7/3.9 and opencv-python and opencv-conrib-python version 4.4.0.46 (as both of these packages has prebuilt wheels).

          On this note, I have opened a feature request to fix this mess so you will be able to install requirements on RPI without having to deal with all these version issues.
          Thanks, Erik

            Morning erik Now I understood, I can install

            1. Depthai 2.9.0.0
            2. opencv-python 4.4.0.46
            3. opencv-conrib-python 4.4.0.46

            I have checked the Github code for DepthAI and still cannot find the version 2.9.0.0. So I hope the version 2.9.0.0 of DepthAI(DAI) will be compatible with the 4.4.0.46 of both opencv-conrib-python(OCP) and opencv-python(OP).

            • erik replied to this.

              Good morning franva, depthai version 2.9 and newer actually have prebuilt pi wheels - so running python3.7 -mpip install depthai==2.9.0.0 should install prebuilt library to your RPI.
              Thanks, Erik

                thanks erik for clarifying the installation. So I just need to install the depthai 2.9.0.0 and this lib will contain OCP and OP.

                Okay, so after I installed it and a couple of other dependencies(including setup the USB rules) and I ran:

                $ python3 depthai_demo.py -cnn deeplabv3p_person
                
                /usr/lib/python3/dist-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.26.6) or chardet (3.0.4) doesn't match a supported version!
                  RequestsDependencyWarning)
                Using depthai module from:  /home/pi/.local/lib/python3.7/site-packages/depthai.cpython-37m-arm-linux-gnueabihf.so
                Depthai version installed:  2.9.0.0
                Available devices:
                [0] 14442C10013762D700 [X_LINK_UNBOOTED]
                Enabling low-bandwidth mode due to low USB speed... (speed: UsbSpeed.HIGH)
                Creating MJPEG link for ColorCamera node and color xlink stream...
                Traceback (most recent call last):
                  File "depthai_demo.py", line 148, in <module>
                    pm.create_color_cam(nn_manager.input_size if conf.useNN else conf.previewSize, rgb_res, conf.args.rgb_fps, conf.args.full_fov_nn, xout=Previews.color.name in conf.args.show)
                  File "/home/pi/Work/MyBuddy/depthai/depthai_helpers/managers.py", line 662, in create_color_cam
                    self.mjpeg_link(self.nodes.cam_rgb, self.nodes.xout_rgb, self.nodes.cam_rgb.video)
                  File "/home/pi/Work/MyBuddy/depthai/depthai_helpers/managers.py", line 623, in mjpeg_link
                    if isinstance(node, dai.ColorCamera) or isinstance(node, dai.MonoCamera):
                AttributeError: module 'depthai' has no attribute 'ColorCamera' 

                So this is the error I got. Could you please help?
                Btw, my python3 is 3.7.3

                Many thanks,

                Winston

                • erik replied to this.

                  Hello franva , in the new 2.9 version there is no longer dai.ColorCamera but dai.node.ColorCamera. We will update depthai_demo today to the new 2.9 version, sorry for the issues.
                  Thanks, Erik