OpenInterpreter / open-interpreter

A natural language interface for computers
http://openinterpreter.com/
GNU Affero General Public License v3.0
52.28k stars 4.62k forks source link

Dependency opencv-python>=4.9.0 doesn't work on old versions of macOS like 11.7 #999

Open Steve235lab opened 7 months ago

Steve235lab commented 7 months ago

Describe the bug

I have the main branch of OI installed from source and tested on an old iMac which runs macOS 11.7.10. An error occurred when I tried to launch OI:

Traceback (most recent call last):
  File "/usr/local/bin/interpreter", line 5, in <module>
    from interpreter.terminal_interface.start_terminal_interface import main
  File "/usr/local/lib/python3.11/site-packages/interpreter/__init__.py", line 2, in <module>
    from .core.core import OpenInterpreter
  File "/usr/local/lib/python3.11/site-packages/interpreter/core/core.py", line 17, in <module>
    from .computer.computer import Computer
  File "/usr/local/lib/python3.11/site-packages/interpreter/core/computer/computer.py", line 9, in <module>
    from .skills.skills import Skills
  File "/usr/local/lib/python3.11/site-packages/interpreter/core/computer/skills/skills.py", line 3, in <module>
    import aifs
  File "/usr/local/lib/python3.11/site-packages/aifs/__init__.py", line 1, in <module>
    from .search import search
  File "/usr/local/lib/python3.11/site-packages/aifs/search.py", line 14, in <module>
    from unstructured.partition.auto import partition
  File "/usr/local/lib/python3.11/site-packages/unstructured/partition/auto.py", line 81, in <module>
    from unstructured.partition.pdf import partition_pdf
  File "/usr/local/lib/python3.11/site-packages/unstructured/partition/pdf.py", line 76, in <module>
    from unstructured.partition.pdf_image.pdf_image_utils import (
  File "/usr/local/lib/python3.11/site-packages/unstructured/partition/pdf_image/pdf_image_utils.py", line 9, in <module>
    import cv2
ImportError: dlopen(/usr/local/lib/python3.11/site-packages/cv2/cv2.abi3.so, 2): Symbol not found: __ZNSt3__113basic_filebufIcNS_11char_traitsIcEEE4openEPKcj
  Referenced from: /usr/local/lib/python3.11/site-packages/cv2/.dylibs/libvmaf.1.dylib (which was built for Mac OS X 12.0)
  Expected in: /usr/lib/libc++.1.dylib

Obviously, this error was caused by the line import cv2. So I tried to run import cv2 directly in interactive python environment, and the same error was thrown. Then I tried to uninstall opencv-python and re-install opencv-python==4.8.1.78, the error was no longer thrown and seems everything works in OI.

So should we limit the version of dependency opencv-python = ">=4.8.1.78,<4.9.0" in pyproject.toml? Or we should just abandon users who are using an old macOS?

Reproduce

See the description.

Expected behavior

Limit dependency opencv-python = ">=4.8.1.78,<4.9.0" in pyproject.toml or add an handler for this import error if you want OI support old versions of macOS. Or just throw a clear deny-to-run message when detects OI running on those OSs.

Screenshots

No response

Open Interpreter version

Built from source on updated main branch

Python version

3.11.4

Operating System name and version

macOS 11.7.10

Additional context

No response

Steve235lab commented 7 months ago

In short, opencv-python >= 4.9.0 is not compatible with old macOS. We should handle this.

Notnaton commented 7 months ago

Are they working on a fix for this in opencv?

Steve235lab commented 7 months ago

Are they working on a fix for this in opencv?

Someone opened an issue, but there's no response yet.

Steve235lab commented 7 months ago

Are they working on a fix for this in opencv?

And it seems the way they will fix the problem is avoid installing the latest version on old systems.