• Community
  • problem on M1 building wheels for depthai

I'm new to the Oak-D and have depthai working fine on my older intel Mac. However, I'm constantly having problems trying to install on a new M1 Mac which keeps reporting the following:

ERROR: Could not build wheels for depthai, which is required to install pyproject.toml-based projects

any suggestions as to how to resolve the issue?
thanks.

  • erik replied to this.

    Hi nicsandiland ,
    What version of depthai are you trying to install? As we have added prebuilt wheels for our library some time ago (see here).
    Thanks, Erik

    HI Eric,
    I was using the following script to install:
    python3 -m pip install opencv-python --force- reinstall --no-cache-dir
    presumably, this would install the latest version?
    thanks,
    Nic

    • erik replied to this.

      Hi nicsandiland ,
      That's for opencv-python, not for depthai. I am not sure about the status of prebuilt m1 wheels of opencv.
      Thanks, Erik

      Sorry I pasted the wrong line:

      (venv) nicsandiland@Nics-MacBook-Pro examples % pip install depthai
      Collecting depthai
      Using cached depthai-2.20.2.0.tar.gz (402 kB)
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
      Preparing metadata (pyproject.toml) ... done
      Building wheels for collected packages: depthai
      Building wheel for depthai (pyproject.toml) ... error
      error: subprocess-exited-with-error


      × Building wheel for depthai (pyproject.toml) did not run successfully.
      │ exit code: 1
      ╰─> [313 lines of output]

      • erik replied to this.

        Hi nicsandiland ,
        What's the version of your python? From the pypi (link above) I found prebuilt wheels for mac arm64 (m1) for python versions 3.9, 3.10 and 3.11. If you have those - could you try force reinstall it?
        Thanks, Erik

        depthai-2.20.2.0-cp39-cp39-macosx_11_0_arm64.whl
        depthai-2.20.2.0-cp310-cp310-macosx_11_0_arm64.whl
        depthai-2.20.2.0-cp311-cp311-macosx_11_0_arm64.whl

        Hi Erik,
        I've been trying different versions of Python installing and uninstalling using pyenv. I currently have 3.11:

        (venv) nicsandiland@Nics-MacBook-Pro pythonProject % pyenv versions

        • system (set by /Users/nicsandiland/.pyenv/version)
          3.11.1
          (venv) nicsandiland@Nics-MacBook-Pro pythonProject %

        I've downloaded the respective file you suggested but am getting an 'unsupported' error:

        (venv) nicsandiland@Nics-MacBook-Pro pythonProject % pip3 install depthai-2.20.2.0-cp311-cp311-macosx_11_0_arm64.whl
        ERROR: depthai-2.20.2.0-cp311-cp311-macosx_11_0_arm64.whl is not a supported wheel on this platform.

        thanks,
        Nic

        • erik replied to this.

          Hi nicsandiland , which macbook pro do you have? This year's one? We will take a look at this issue.
          Thanks, Erik

          I've literally just bought it, though it's not the most recent model:
          14" 2021 M1 Pro 16GB
          Monterery 12.6.3

          thanks
          Nic

            @nicsandiland thanks for the report. Do you mind running these:

            pip3 --version
            python3 -m pip --version
            python3 -c 'import platform; print(platform.machine())'
            python3 --version

            and pasting the output?

            3 months later

            nicsandiland

            This is my mac model too, and these are the problems I'm currently running into… fingers-crossed for the solution.

            except:

            Ventura 13.3.1

            and the output from the request above:

            pip 22.0.4 from /Users/amandaperry/.pyenv/versions/3.7.16/lib/python3.7/site-packages/pip (python 3.7)

            pip 22.0.4 from /Users/amandaperry/.pyenv/versions/3.7.16/lib/python3.7/site-packages/pip (python 3.7)

            arm64

            Python 3.7.16

            @AmandaPerry

            python3 -c 'import platform; print(platform.machine())'

            Do you mind running the above?

            I suggest to install python3 arm64 from python.org

            Example:
            curlhttps://www.python.org/ftp/python/3.9.13/python-3.9.13-macos11.pkg--output p3.9.pkg
            sudo installer -pkg p3.9.pkg -target /

            And uninstall other versions of Python. Make sure above prints arm64 and then install with python3 -m pip install depthai

            amandaperry@Amandas-MBP people % curl https://www.python.org/ftp/python/3.9.13/python-3.9.13-macos11.pkg --output p3.9.pkg

            % Total % Received % Xferd Average Speed Time Time Time Current

                                         Dload  Upload   Total   Spent    Left  Speed

            100 37.0M 100 37.0M 0 0 20.8M 0 0:00:01 0:00:01 --:--:-- 20.9M

            amandaperry@Amandas-MBP people % sudo installer -pkg p3.9.pkg -target /

            Password:

            installer: Package name is Python

            installer: Upgrading at base path /

            installer: The upgrade was successful.

            amandaperry@Amandas-MBP people % python3 -c 'import platform; print(platform.machine())'

            arm64

            amandaperry@Amandas-MBP people % python3 -m pip install depthai

            Requirement already satisfied: depthai in /Users/amandaperry/.pyenv/versions/3.7.16/lib/python3.7/site-packages (2.21.2.0)

            WARNING: You are using pip version 22.0.4; however, version 23.1.2 is available.

            You should consider upgrading via the '/Users/amandaperry/.pyenv/versions/3.7.16/bin/python3 -m pip install --upgrade pip' command.

            Ah need to uninstall other python versions, one sec

            OK, looks the same output to me. here it is:

            amandaperry@Amandas-MBP people % curl https://www.python.org/ftp/python/3.9.13/python-3.9.13-macos11.pkg --output p3.9.pkg

            % Total % Received % Xferd Average Speed Time Time Time Current

                                         Dload  Upload   Total   Spent    Left  Speed

            100 37.0M 100 37.0M 0 0 26.9M 0 0:00:01 0:00:01 --:--:-- 27.0M

            amandaperry@Amandas-MBP people % sudo installer -pkg p3.9.pkg -target /

            Password:

            installer: Package name is Python

            installer: Upgrading at base path /

            installer: The upgrade was successful.

            amandaperry@Amandas-MBP people % python3 -m pip install depthai

            Requirement already satisfied: depthai in /Users/amandaperry/.pyenv/versions/3.7.16/lib/python3.7/site-packages (2.21.2.0)

            WARNING: You are using pip version 22.0.4; however, version 23.1.2 is available.

            You should consider upgrading via the '/Users/amandaperry/.pyenv/versions/3.7.16/bin/python3 -m pip install --upgrade pip' command.

            I then tried:

            pip install -r requirements.txt

            and got the error:

            Building wheels for collected packages: depthai
            Building wheel for depthai (pyproject.toml) ... error
            error: subprocess-exited-with-error

            × Building wheel for depthai (pyproject.toml) did not run successfully.
            │ exit code: 1
            ─> [63 lines of output]

            RuntimeError: CMake must be installed to build the following extensions: depthai
            [end of output]
            note: This error originates from a subprocess, and is likely not a problem with pip.
            ERROR: Failed building wheel for depthai
            Failed to build depthai
            ERROR: Could not build wheels for depthai, which is required to install pyproject.toml-based projects

            going to dig up that .pyenv/versions/3.7.16 and remove