Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCV 4.7 Symbol not found: on Mac 11, requires MacOS 12 #777

Closed
4 tasks done
anttiryt opened this issue Jan 13, 2023 · 12 comments
Closed
4 tasks done

OpenCV 4.7 Symbol not found: on Mac 11, requires MacOS 12 #777

anttiryt opened this issue Jan 13, 2023 · 12 comments
Labels

Comments

@anttiryt
Copy link

System Information

OpenCV python version 4.7.0.68
Operation System / Platform: Macos BigSur 11.6.7
Python version: 3.10.8

Detailed description

Using latest opencv-python from pip does not work on Big Sur.

4.6.0.66 works ok.

Symbot not found - using shared library

cv2/cv2.abi3.so, 2): Symbol not found: __ZNKSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strEv

cv2/.dylibs/libjxl.0.7.0.dylib (which was built for Mac OS X 12.0)

Traceback (most recent call last):
  File "/Users/rac/src/tf2-frames/super-slomo/inference.py", line 6, in <module>
    import cv2
  File "/opt/homebrew/Caskroom/miniconda/base/envs/tf2/lib/python3.10/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/opt/homebrew/Caskroom/miniconda/base/envs/tf2/lib/python3.10/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/opt/homebrew/Caskroom/miniconda/base/envs/tf2/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: dlopen(/Volumes/Extra/miniconda/base/envs/tf2/lib/python3.10/site-packages/cv2/cv2.abi3.so, 2): Symbol not found: __ZNKSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strEv
  Referenced from: /Volumes/Extra/miniconda/base/envs/tf2/lib/python3.10/site-packages/cv2/.dylibs/libjxl.0.7.0.dylib (which was built for Mac OS X 12.0)
  Expected in: /usr/lib/libc++.1.dylib

(tf2) rac@82-181-219-151 blades % 

Steps to reproduce

I don't think this is reproducable on other systems.

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)
@anttiryt anttiryt added the bug label Jan 13, 2023
@icvua
Copy link

icvua commented Jan 21, 2023

I'm having the same issue.

@soraew
Copy link

soraew commented Jan 23, 2023

I'm having the same issue as well.

@asmorkalov
Copy link
Collaborator

Reproduced with Mac mini M1 with MacOS 11.1:

(base) xperience@xpereince-mini-m1 venv % python3.9 -m venv .  
(base) xperience@xpereince-mini-m1 venv % source ./bin/activate
(venv) (base) xperience@xpereince-mini-m1 venv % pip install --upgrade pip
Requirement already satisfied: pip in ./lib/python3.9/site-packages (21.1.1)
Collecting pip
  Using cached pip-22.3.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 21.1.1
    Uninstalling pip-21.1.1:
      Successfully uninstalled pip-21.1.1
Successfully installed pip-22.3.1
(venv) (base) xperience@xpereince-mini-m1 venv % pip install opencv-python
Collecting opencv-python
  Using cached opencv_python-4.7.0.68-cp37-abi3-macosx_11_0_arm64.whl (31.1 MB)
Collecting numpy>=1.19.3
  Using cached numpy-1.24.1-cp39-cp39-macosx_11_0_arm64.whl (13.9 MB)
Installing collected packages: numpy, opencv-python
Successfully installed numpy-1.24.1 opencv-python-4.7.0.68
(venv) (base) xperience@xpereince-mini-m1 venv % python 
Python 3.9.5 (default, Jun  4 2021, 05:25:09) 
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/xperience/asmorkalov/venv/lib/python3.9/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/Users/xperience/asmorkalov/venv/lib/python3.9/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/Users/xperience/.pyenv/versions/3.9.5/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: dlopen(/Users/xperience/asmorkalov/venv/lib/python3.9/site-packages/cv2/cv2.abi3.so, 2): Symbol not found: __ZNKSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strEv
  Referenced from: /Users/xperience/asmorkalov/venv/lib/python3.9/site-packages/cv2/.dylibs/libjxl.0.7.0.dylib (which was built for Mac OS X 12.0)
  Expected in: /usr/lib/libc++.1.dylib

>>> 
>>> 
>>> quit()

@asmorkalov
Copy link
Collaborator

The library is needed for FFmpeg.

@anttiryt
Copy link
Author

The library is needed for FFmpeg.

Can you use 4.6 ?

@asmorkalov
Copy link
Collaborator

Fixed in 4.7.0.70

@BeteAF
Copy link

BeteAF commented Jan 6, 2024

pip install opencv-python==4.6.0.66
I am using macOS Big Sur 11.5. I tried with 4.7.0.72, but doesn't work, then I tried 4.6.0.66 and it worked

@Thoughtyness
Copy link

On macOS BigSur 11.7.10, 4.8.1.78 works, but the next version I can install, 4.9.0.80, reproduces this error.

@asmorkalov
Copy link
Collaborator

OpenCV team uses Github Action provided VMs for Mac OS build and Brew packages for dependencies. The last release was done for MasOS 11 x86_64 and MacOS 12 arm64 due to dependencies reason. I'll take a look if we can decrease requirements for the next release, but probability is low.

copybara-service bot pushed a commit to google-deepmind/meltingpot that referenced this issue Mar 20, 2024
PiperOrigin-RevId: 617338588
Change-Id: I648485038663fe989d21b194c3d863a2ef2f1a77
@edsonms
Copy link

edsonms commented Apr 2, 2024

I have the same issue on Mac OS Big Sur version 11.7.10

@kaustubh2024
Copy link

I have the same error on Mac Big Sur 11.7.10.

Exact error is this:
ImportError: dlopen(/Users/Kaustubh/Library/Python/3.12/lib/python/site-packages/cv2/cv2.abi3.so, 2): Symbol not found: __ZNSt3__113basic_filebufIcNS_11char_traitsIcEEE4openEPKcj
Referenced from: /Users/Kaustubh/Library/Python/3.12/lib/python/site-packages/cv2/.dylibs/libvmaf.1.dylib (which was built for Mac OS X 12.0)
Expected in: /usr/lib/libc++.1.dylib

@edsonms
Copy link

edsonms commented Apr 4, 2024

I have the same error on Mac Big Sur 11.7.10.

Exact error is this: ImportError: dlopen(/Users/Kaustubh/Library/Python/3.12/lib/python/site-packages/cv2/cv2.abi3.so, 2): Symbol not found: __ZNSt3__113basic_filebufIcNS_11char_traitsIcEEE4openEPKcj Referenced from: /Users/Kaustubh/Library/Python/3.12/lib/python/site-packages/cv2/.dylibs/libvmaf.1.dylib (which was built for Mac OS X 12.0) Expected in: /usr/lib/libc++.1.dylib

If you find a solution let me know. I got exactly the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants