Skip to content

import cv2 complain when installing quantus with python == 3.9 in virtual env  #344

@annahedstroem

Description

@annahedstroem

Description

>>> python3.9 -m venv venvs/testenv
>>> source venvs/testenv/bin/activate
>>> pip install git+https://github.com/understandable-machine-intelligence-lab/Quantus.git # succesfully installs
>>> import quantus
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/annahedstroem/Projects/venvs/quantustrans/lib/python3.9/site-packages/quantus/__init__.py", line 11, in <module>
    from quantus.evaluation import evaluate
  File "/Users/annahedstroem/Projects/venvs/quantustrans/lib/python3.9/site-packages/quantus/evaluation.py", line 19, in <module>
    from quantus.functions.explanation_func import explain
  File "/Users/annahedstroem/Projects/venvs/quantustrans/lib/python3.9/site-packages/quantus/functions/explanation_func.py", line 17, in <module>
    from quantus.helpers import constants
  File "/Users/annahedstroem/Projects/venvs/quantustrans/lib/python3.9/site-packages/quantus/helpers/constants.py", line 14, in <module>
    from quantus.functions.perturb_func import *
  File "/Users/annahedstroem/Projects/venvs/quantustrans/lib/python3.9/site-packages/quantus/functions/perturb_func.py", line 14, in <module>
    import cv2
  File "/Users/annahedstroem/Projects/venvs/quantustrans/lib/python3.9/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/Users/annahedstroem/Projects/venvs/quantustrans/lib/python3.9/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/usr/local/Cellar/python@3.9/3.9.17_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: dlopen(/Users/annahedstroem/Projects/venvs/quantustrans/lib/python3.9/site-packages/cv2/cv2.abi3.so, 2): Symbol not found: __ZNSt3__113basic_filebufIcNS_11char_traitsIcEEE4openEPKcj
  Referenced from: /Users/annahedstroem/Projects/venvs/quantustrans/lib/python3.9/site-packages/cv2/.dylibs/libvmaf.1.dylib (which was built for Mac OS X 12.0)
  Expected in: /usr/lib/libc++.1.dylib

Steps to reproduce the behavior

Solution that works:

pip install opencv-python==4.8.1.78        

Minimum acceptance criteria

  • Specify what is necessary for the issue to be closed.
  • @mentions of the person that is apt to review these changes e.g., @annahedstroem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions