I need to install a module pyzbar which depends on another called zbar. According to the pypi link I first need to install zbar via
brew install zbar
then install the pyzbar
pip install pyzbar
Having done of that when trying to run a code based on importing specific part of the module, it gives an error.
from pyzbar.pyzbar import decode
The error is ImportError: Unable to find zbar shared library
How to check where exactly is the issue coming from and how to resolve it?
Here are steps I took after checking comments: 1- Tried finding libzbar file and some how link that to the path so that the pyzbar file zbar_library.py can find that. The libzbar files were in this location /opt/homebrew/Cellar/zbar/0.23.90 installed by homebrew and not in usr/local/lib (which surprisingly no such directory exists on my mac). The way I added the location of zbar lib file to path was by
export DYLD_LIBRARY_PATH=/opt/homebrew/lib
in the terminal while I'm in the conda environment on which my python is running. Now when trying to run python while importing pyzbar it finds something and no longer give the "no shared lib found" error, but gives the following errors:
File "/Users/username/miniconda3/envs/my_env/lib/python3.7/site-packages/pyzbar/zbar_library.py", line 66, in load
libzbar = cdll.LoadLibrary(path)
File "/Users/username/miniconda3/envs/my_env/lib/python3.7/ctypes/__init__.py", line 442, in LoadLibrary
return self._dlltype(name)
File "/Users/username/miniconda3/envs/my_env/lib/python3.7/ctypes/__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/opt/homebrew/lib/libzbar.dylib, 6): no suitable image found. Did find:
/opt/homebrew/lib/libzbar.dylib: mach-o, but wrong architecture
/opt/homebrew/Cellar/zbar/0.23.90/lib/libzbar.0.dylib: mach-o, but wrong architecture
/opt/homebrew/lib/libzbar.dylib: mach-o, but wrong architecture
/opt/homebrew/Cellar/zbar/0.23.90/lib/libzbar.0.dylib: mach-o, but wrong architecture
from Module installed but can't find a shared library installed by Brew
No comments:
Post a Comment