Repository: All-Hands-AI/OpenHands

Issue #6045: [Bug]: Installing opencv-python (4.10.0.84): Failed
Created: 2025-01-05T05:09:20Z
Is there an existing issue for the same bug?

 I have checked the existing issues.

Describe the bug and reproduction steps
I was using mamba on a MacBook Air 15-inch M3, 2024. I got the following error:
make build
Building project...
Checking dependencies...
Checking system...
macOS detected.
Checking Python installation...
Python 3.12.8 is already installed.
Checking npm installation...
npm 10.9.0 is already installed.
Checking Node.js installation...
Node.js 22.12.0 is already installed.
Checking Docker installation...
Docker version 27.3.1, build ce12230 is already installed.
Checking Poetry installation...
Poetry (version 1.8.5) is already installed.
Dependencies checked successfully.
Installing Python dependencies...
Defaulting TZ (timezone) to UTC
Using virtualenv: /Users/liao6/Library/Caches/pypoetry/virtualenvs/openhands-ai-O1UGlCDt-py3.12
Installing chroma-hnswlib...
Requirement already satisfied: chroma-hnswlib in /Users/liao6/Library/Caches/pypoetry/virtualenvs/openhands-ai-O1UGlCDt-py3.12/lib/python3.12/site-packages (0.7.6)
Requirement already satisfied: numpy in /Users/liao6/Library/Caches/pypoetry/virtualenvs/openhands-ai-O1UGlCDt-py3.12/lib/python3.12/site-packages (from chroma-hnswlib) (2.2.1)
Installing dependencies from lock file

Package operations: 1 install, 0 updates, 0 removals

  - Installing opencv-python (4.10.0.84): Failed

  ChefBuildError

  Backend 'setuptools.build_meta:__legacy__' is not available.
  
  Cannot import 'setuptools.build_meta'

  at ~/miniforge3/lib/python3.12/site-packages/poetry/installation/chef.py:164 in _prepare
      160│ 
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│ 
      163│             if error is not None:
    → 164│                 raise error from None
      165│ 
      166│             return path
      167│ 
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with opencv-python (4.10.0.84) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "opencv-python (==4.10.0.84)"'.

make[1]: *** [install-python-dependencies] Error 1
make: *** [build] Error 2


OpenHands Installation
Development workflow
OpenHands Version
main d2790c8
Operating System
MacOS
Logs, Errors, Screenshots, and Additional Context
I was following instructions from https://github.com/All-Hands-AI/OpenHands/blob/main/Development.md
The error happens at Step 2. "make build".

Duplicate issue #6063: [Bug]: Build error on `opencv-python`
Created: 2025-01-06T03:43:32Z
Is there an existing issue for the same bug?

 I have checked the existing issues.

Describe the bug and reproduction steps
We have a build error related to opencv-python on my mac.
$ make build
Building project...
Checking dependencies...
Checking system...
macOS detected.
Checking Python installation...
Python 3.12.8 is already installed.
Checking npm installation...
npm 10.9.0 is already installed.
Checking Node.js installation...
Node.js 23.3.0 is already installed.
Checking Docker installation...
Docker version 27.4.0, build bde2b89 is already installed.
Checking Poetry installation...
Poetry (version 1.8.4) is already installed.
Dependencies checked successfully.
Installing Python dependencies...
Defaulting TZ (timezone) to UTC
Using virtualenv: /Users/gneubig/Library/Caches/pypoetry/virtualenvs/openhands-ai-mHbwbJq6-py3.12
Installing chroma-hnswlib...
Requirement already satisfied: chroma-hnswlib in /Users/gneubig/Library/Caches/pypoetry/virtualenvs/openhands-ai-mHbwbJq6-py3.12/lib/python3.12/site-packages (0.7.6)
Requirement already satisfied: numpy in /Users/gneubig/Library/Caches/pypoetry/virtualenvs/openhands-ai-mHbwbJq6-py3.12/lib/python3.12/site-packages (from chroma-hnswlib) (2.2.1)
Installing dependencies from lock file

Package operations: 1 install, 0 updates, 0 removals

  - Installing opencv-python (4.10.0.84): Failed

  ChefBuildError

  Backend 'setuptools.build_meta:__legacy__' is not available.
  
  Cannot import 'setuptools.build_meta'

  at ~/Library/Application Support/pypoetry/venv/lib/python3.13/site-packages/poetry/installation/chef.py:164 in _prepare
      160│ 
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│ 
      163│             if error is not None:
    → 164│                 raise error from None
      165│ 
      166│             return path
      167│ 
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with opencv-python (4.10.0.84) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "opencv-python (==4.10.0.84)"'.

make[1]: *** [install-python-dependencies] Error 1
make: *** [build] Error 2

I'm actually not sure if we need opencv-python at all in our repo, so I think it might be worth attempting to remove this dependency and run INSTALL_DOCKER=0 make build to see if the project still builds. If it does, we can just remove the dependency. Otherwise, we will need to take some other course of action, such as pinning opencv-python to a working version.
OpenHands Installation
Development workflow
OpenHands Version
main
Operating System
MacOS
Logs, Errors, Screenshots, and Additional Context
No response

Closing comment (2025-01-06T13:49:06Z): Duplicate of #6045.
Was this fixed though? I don't see it on my Mac. Wondering if there is a specific environment thing here.