Skip to content

"Unable to find zbar shared library" on MacOS #10

@HughHoyland

Description

@HughHoyland

First, thank you for the amazing tool. I needed it.

On Mac, it installs fine, but when running, I hit

  File "/Users/foobar/src/pdf-redactor/pdf_redactor.py", line 13, in <module>
    from pyzbar.pyzbar import decode
  File "/Users/foobar/src/pdf-redactor/.venv/lib/python3.13/site-packages/pyzbar/pyzbar.py", line 7, in <module>
    from .wrapper import (
    ...<9 lines>...
    )
  File "/Users/foobar/src/pdf-redactor/.venv/lib/python3.13/site-packages/pyzbar/wrapper.py", line 151, in <module>
    zbar_version = zbar_function(
        'zbar_version',
    ...<2 lines>...
        c_uint_p,    # minor
    )
  File "/Users/foobar/src/pdf-redactor/.venv/lib/python3.13/site-packages/pyzbar/wrapper.py", line 148, in zbar_function
    return prototype((fname, load_libzbar()))
                             ~~~~~~~~~~~~^^
  File "/Users/foobar/src/pdf-redactor/.venv/lib/python3.13/site-packages/pyzbar/wrapper.py", line 127, in load_libzbar
    libzbar, dependencies = zbar_library.load()
                            ~~~~~~~~~~~~~~~~~^^
  File "/Users/foobar/src/pdf-redactor/.venv/lib/python3.13/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

Apparently, "Pure python" in pyzbar announcement is, err, not exactly true.

I admit, I installed dependencies in a different manner, with
uv pip install -r requirements.txt

I just hacked around it, but apparently there needs to be a shared library.

Or alternatively, one can repeat my hack

try:
  from pyzbar.pyzbar import decode
except:
  print('[Error] libzbar not found, QR codes disabled')
  def decode(foo): return []

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions