1

I just installed Opencv 3.2 using conda forge on Anaconda with python 3.6. While using bash to run import cv2 works alright, running this command on fish shell outputs this error message.

import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/vicarious/anaconda/lib/python3.6/site-packages/cv2.so, 2): Library not loaded: @rpath/libopencv_hdf.3.2.dylib
Referenced from: /Users/vicarious/anaconda/lib/python3.6/site-packages/cv2.so
Reason: image not found

I checked out this question and added set -x DYLD_FALLBACK_LIBRARY_PATH /Users/vicarious/anaconda/lib/ $DYLD_FALLBACK_LIBRARY_PATH fish config file which did not help.

I also disabled MacOS Sierra SIP as it apparently does not let DYLD_FALLBACK_LIBRARY_PATH to be changed. But I still get the same error.

What should I do?

Vicarious
  • 131
  • 18

1 Answers1

1

Works for me using fish as my default shell on macOS Sierra 10.12:

python
Python 3.6.0a3 | packaged by conda-forge | (default, Jul 12 2016, 15:51:25)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> print(cv2.__version__)
3.2.0
>>> exit()

If it works in bash but not fish then your bash environment is probably defining an environment var that isn't present in the fish environment or has a different value. Also, I installed opencv2 using conda install -c conda-forge opencv. If you built it from source or installed it in some other manner that is likely a factor.

Kurtis Rader
  • 6,734
  • 13
  • 20