• Community
  • TypeError: depthai.Pipeline: No constructor defined!

I tried to run 01_rgb_preview.py and run_test error

F:\lib\depthai-python>examples\01_rgb_preview.py
Traceback (most recent call last):
  File "F:\lib\depthai-python\examples\01_rgb_preview.py", line 8, in <module>
    pipeline = dai.Pipeline()
TypeError: depthai.Pipeline: No constructor defined!

What's wrong?

When I run run_test.py I have got many errors

Device get data failed: 7
F: [global] [         0] [EventRead00Thr] dispatcherEventReceive:91     Duplicate id detected.

b_WritePipe: System err 22

WinUsb_WritePipe failed with error:=22
WinUsb_WritePipe failed with error:=31

full output

    Thanks for your answer

    Now it works.

    depth-demo is dead now

    depthai_demo.py
    No calibration file. Using Calibration Defaults.
    Using depthai module from:  F:\Program Files\Python\lib\site-packages\depthai.cp38-win_amd64.pyd
    Depthai version installed:  0.0.2.1+9b7d9364ccb94e26c8754a2e0a69b2dafe6de145
    Version mismatch between installed depthai lib and the required one by the script.
                    Required:  0.4.1.1
                    Installed: 0.0.2.1+9b7d9364ccb94e26c8754a2e0a69b2dafe6de145
                    Run: python3 install_requirements.py

    I think is for the other api. 2 api is really confusing.

    Thanks again for your help

      Sorry lberger for the confusion.

      Yes, the Gen1 and Gen2 APIs are completely different. The Gen2 API was actually a complete re-write from what we learned from Gen1 (and Gen0, which is long-since gone).

      So one of the main pieces of feedback from Gen1 is that folks did not want one big demo application (depthai_demo.py) but instead a bunch of smaller, easier-to-read/understand examples of each functionality - and then a pipeline system where these could be tied together.

      So these easier-to-read examples are here: https://docs.luxonis.com/projects/api/en/gen2_develop/, and then we show-case how to use them to build more complex AI/CV flows here (see the gen2- examples).

      But when using an example, we recommend installing the pertinent version by running python3 -m pip install -r requirements.txt for the given example. One clean way to do this is to use PyCharm, which makes a virtual environment for each example, so then each will have its own version.

      Then for developing a custom application, we recommend working off of gen2_develop of the API. We will be doing our first official release of Gen2 at the end of February (we intended to do so at the end of December, but we are behind).

      Thoughts?

      Thanks and sorry about the confusion here.
      -Brandon


        8 days later

        Brandon Thank you for making Gen2 available now. If I want to keep Gen1 while installing Gen2, is it possible to install Gen2 in a separate folder at cmd line, then use PyCharm for individual projects so they share the same Gen2 installation? I installed Gen1 at cmd line without PyCharm, then create and run each project under its PyCharm env. Just wonder if Gen1 Gen2 would conflict each other due to, say path settings.

        -Jason

        • erik replied to this.

          erik Hi @Jason - yes as Erik (from Luxonis) using virtual environments (and actually PyCharm can manage these for you) would allow you to select between them so that you can switch back/forth easily per project.

          Thoughts?

          Thanks,
          Brandon

            Brandon erik
            Brandon, Erik, thanks for the reply. Sounds like as long the projects are under PyCharm VE, Gen1 and Gen2 can both be installed and the projects for them would function under their respective VE. I will test it out after a system backup.

            Jason

            7 days later

            Brandon One clean way to do this is to use PyCharm, which makes a virtual environment for each example, so then each will have its own version.

            Sorry for delay.

            I don't want to use pycharm.

            Now is oak-d python api is only compatible with pycharm?
            What's about other environement ?

            Hi @Iberger,

            PyCharm is not required. You can use just a terminal in macOS, Linux, Windows, or other OSes. We just recommend PyCharm for folks who don't already have or use an environment. Kind of a pick one sort of recommendation.

            But DepthAI even works with ESP32.

            Anyway, installation instructions for Python are here:
            https://docs.luxonis.com/projects/api/en/latest/install/

            Thoughts?

            Thanks,
            Brandon