npinchot / zbar

ZBar python wrapper for ZBar bar code library
GNU Lesser General Public License v2.1
33 stars 21 forks source link

not support macbook pro m1? #3

Open Daniel-ccx opened 3 years ago

Daniel-ccx commented 3 years ago

brew install zbar

Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
To rerun under ARM use:
    arch -arm64 brew install ...
To install under x86_64, install Homebrew into /usr/local.

Then :

arch -arm64 brew install zbar


==> Installing zbar
==> Pouring zbar-0.23.90.arm64_big_sur.bottle.tar.gz
🍺  /opt/homebrew/Cellar/zbar/0.23.90: 33 files, 889.5KB
==> Upgrading 5 dependents:
ffmpeg 4.3.2_3 -> 4.3.2_4, numpy 1.20.1_1 -> 1.20.2, sip 6.0.3 -> 6.0.3_1, opencv 4.5.1_3 -> 4.5.2, pyqt@5 5.15.4 -> 5.15.4_1

and run python script still throw error:

File "/opt/anaconda3/lib/python3.8/site-packages/pyzbar/wrapper.py", line 115, in load_libzbar libzbar, dependencies = zbar_library.load() File "/opt/anaconda3/lib/python3.8/site-packages/pyzbar/zbar_library.py", line 65, in load raise ImportError('Unable to find zbar shared library') ImportError: Unable to find zbar shared library


I'm not sure what is going on.

I had to copy "zbar/0.23.90/lib and bin" files to  "/opt/anaconda3/lib/ and bin "directory.But still diffrent error:

/opt/anaconda3/bin/../lib/libzbar.dylib, 6): no suitable image found /opt/anaconda3/bin/../lib/libzbar.dylib: mach-o, but wrong architecture

yangqingbin commented 3 years ago

I have the same problem. Have you solved it

swsoyee commented 3 years ago

Same here

ProsperousSun commented 3 years ago

I have the same problem. Have you solved it?

I have saved it . you should install brew to ‘/usr/local/bin/brew’. you can see blog : https://www.jianshu.com/p/a4b9f490e54c

https://www.jianshu.com/p/f183063fd13b

https://blog.csdn.net/luofuyin9555/article/details/114363585

npinchot commented 3 years ago

Hi folks. I don't have an m1 Mac to test this with. I'm not the main Python zbar library person - I just forked it a while back to add some fixes I needed. I'm probably not able to help on this one. You might have a better result posting a support issue at http://zbar.sourceforge.net/support.html

loookashow commented 3 years ago

Hey, guys. I solved this problem. You just needed to use python interpreter installed with brew. For example: use "/opt/homebrew/Cellar/python@3.9/3.9.9/bin/python3" instead your current.

npinchot commented 2 years ago

@loookashow Do you mind detailing a bit more how you got the build process to use the python interpreter from Homebrew? What did you update to use "/opt/homebrew/Cellar/python@3.9/3.9.9/bin/python3"? This could help other folks with the same issue.

I'll be getting an M1 Mac soon. Will do my best to help once I have one. However, as a note, I've stopped compiling this library directly on my Mac. I only currently use it inside a Docker container on my Mac so that I don't need to deal with as many issues like this.

TzachiGuetta commented 2 years ago

Hey, guys. I solved this problem. You just needed to use python interpreter installed with brew. For example: use "/opt/homebrew/Cellar/python@3.9/3.9.9/bin/python3" instead your current.

Worked for me

0xdoll commented 2 years ago

This solution solved this problem for any Python interpreters.

$ mkdir ~/lib $ ln -s $(brew --prefix zbar)/lib/libzbar.dylib ~/lib/libzbar.dylib

marrtinol commented 2 years ago

This solution solved this problem for any Python interpreters.

$ mkdir ~/lib $ ln -s $(brew --prefix zbar)/lib/libzbar.dylib ~/lib/libzbar.dylib

Thank you! I have tried many ways, and this worked for me finally.

lakshaychhabra commented 2 years ago

I had to use TensorFlow in the same repo hence was limited with options of interpreter and had to stick with miniforge. Issue I faced was it was always reading from x86 path not from arm64 version i installed. Use arch -arm64 brew install zbar will create a folder in /usr/local/Cellar/zbar/0.23.90_2 brew install zbar will create a folder in /usr/local/Cellar/zbar/0.23.90_1 Copy /opt/homebrew/Cellar/zbar/0.23.90_2 and put it in /usr/local/Cellar/zbar/ delete /usr/local/Cellar/zbar/0.23.90_1 change the name of 0.23.90_2 to 0.23.90_1

https://stackoverflow.com/questions/64963370/error-cannot-install-in-homebrew-on-arm-processor-in-intel-default-prefix-usr

xcolour commented 1 year ago

This solution solved this problem for any Python interpreters.

$ mkdir ~/lib $ ln -s $(brew --prefix zbar)/lib/libzbar.dylib ~/lib/libzbar.dylib

Just want to add that there is a non-invasive solution to this problem as well. The underlying issue is that on apple silicon, homebrew installs to /opt/homebrew instead of /usr/local by default, and so libraries installed by homebrew aren't on the default search path, but you can modify the python's search path by setting the DYLD_LIBRARY_PATH environment variable. For example:

$ export DYLD_LIBRARY_PATH="$(brew --prefix)/lib:$DYLD_LIBRARY_PATH"
$ python -c "import pyzbar.pyzbar"
rahulteja526 commented 1 year ago

This solution solved this problem for any Python interpreters.

$ mkdir ~/lib $ ln -s $(brew --prefix zbar)/lib/libzbar.dylib ~/lib/libzbar.dylib

This worked for me. thank you :)

huxianghe commented 5 months ago

This solution solved this problem for any Python interpreters.

$ mkdir ~/lib $ ln -s $(brew --prefix zbar)/lib/libzbar.dylib ~/lib/libzbar.dylib

perfect!

cyinen commented 2 weeks ago

(base) ➜ GetQzonehistory git:(main) brew install zbar Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update! Running brew update --auto-update... Warning: You are using macOS 15. We do not provide support for this pre-release version. It is expected behaviour that some formulae will fail to build in this pre-release version. It is expected behaviour that Homebrew will be buggy and slow. Do not create any issues about this on Homebrew's GitHub repositories. Do not create any issues even if you think this message is unrelated. Any opened issues will be immediately closed without response. Do not ask for help from Homebrew or its maintainers on social media. You may ask for help in Homebrew's discussions but are unlikely to receive a response. Try to figure out the problem yourself and submit a fix as a pull request. We will review it but may or may not accept it.

Error: unknown or unsupported macOS version: :dunno