pyzbar: FileNotFoundError: Could not find module 'libzbar-64.dll' (or one of its dependencies). Try using the full path with constructor syntax.

Thanks for this wonderful tool.

I am using Python 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)] on Windows 10.

After pip installing pyzbar I have got the following dll import errors:

Traceback (most recent call last):

  File "C:\Users\xxxx\anaconda3\lib\site-packages\pyzbar\zbar_library.py", line 58, in load
    dependencies, libzbar = load_objects(Path(''))

  File "C:\Users\xxxxx\anaconda3\lib\site-packages\pyzbar\zbar_library.py", line 54, in load_objects
    libzbar = cdll.LoadLibrary(str(directory.joinpath(fname)))

  File "C:\Users\xxxxx\anaconda3\lib\ctypes\__init__.py", line 451, in LoadLibrary
    return self._dlltype(name)

  File "C:\Users\xxxxx\anaconda3\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)

FileNotFoundError: Could not find module 'libzbar-64.dll' (or one of its dependencies). Try using the full path with constructor syntax.


During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "C:\Users\PhaseONE-Rainbow\Desktop\libraryframework-master\libraryframework-master\libfrem\registro_movimentiv3.py", line 3, in <module>
    from AcquireQR import acquireQRandInfo

  File "C:\Users\xxxx\Desktop\libraryframework-master\libraryframework-master\libfrem\AcquireQR.py", line 2, in <module>
    from pyzbar import pyzbar

  File "C:\Users\xxxx\anaconda3\lib\site-packages\pyzbar\pyzbar.py", line 7, in <module>
    from .wrapper import (

  File "C:\Users\xxxxxx\anaconda3\lib\site-packages\pyzbar\wrapper.py", line 139, in <module>
    zbar_version = zbar_function(

  File "C:\Users\xxxxxx\anaconda3\lib\site-packages\pyzbar\wrapper.py", line 136, in zbar_function
    return prototype((fname, load_libzbar()))

  File "C:\Users\xxxxxx\anaconda3\lib\site-packages\pyzbar\wrapper.py", line 115, in load_libzbar
    libzbar, dependencies = zbar_library.load()

  File "C:\Users\xxxxxxx\anaconda3\lib\site-packages\pyzbar\zbar_library.py", line 60, in load
    dependencies, libzbar = load_objects(Path(__file__).parent)

  File "C:\Users\xxxxxx\anaconda3\lib\site-packages\pyzbar\zbar_library.py", line 54, in load_objects
    libzbar = cdll.LoadLibrary(str(directory.joinpath(fname)))

  File "C:\Users\xxxxx\anaconda3\lib\ctypes\__init__.py", line 451, in LoadLibrary
    return self._dlltype(name)

  File "C:\Users\xxxxx\anaconda3\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)

FileNotFoundError: Could not find module 'C:\Users\xxxxx\anaconda3\lib\site-packages\pyzbar\libzbar-64.dll' (or one of its dependencies). Try using the full path with constructor syntax.

anaconda3\lib\site-packages\pyzbar\ conatins both .dll (libiconv and libzbar-64). I have tried

`os.add_dll_directory(r"C:\Users\xxxxx\anaconda3\lib\site-packages\pyzbar")

` But it does not solve the issue.

Can you help me please?

Best regards, giacomo

About this issue

Most upvoted comments

I had the same issue, till I read all the README and then I found:

Windows error message If you see an ugly ImportError when importing pyzbar on Windows you will most likely need the Visual C++ Redistributable Packages for Visual Studio 2013. Install vcredist_x64.exe if using 64-bit Python, vcredist_x86.exe if using 32-bit Python.

Installing vcredist_x64.exe solved the issue for me.

For others finding this the link (for me at the moment) for the redistributables is https://www.microsoft.com/en-gb/download/details.aspx?id=40784

For others finding this the link (for me at the moment) for the redistributables is https://www.microsoft.com/en-gb/download/details.aspx?id=40784

It was already installed on my system. I was getting the same error when installing from conda (conda install -c conda-forge pyzbar). What solved for me was to uninstall the conda package (conda remove -c conda-forge pyzbar) and install pyzbar through pip (pip install pyzbar).

Since using pip inside a conda env is not recommended, I grabbed the DLL files (libiconv.dll and libzbar-64.dll) from the pip installation, uninstalled the pip package (pip uninstall pyzbar), installed pyzbar again from conda-forge, and pasted the DLL files into the folder shown in the error message.

That said, how can those DLL files be included in the conda-forge installation?

yes its works man, thanks buddy "If you have this error download and install ms visual C++ 2013 "

I had the same issue, till I read all the README and then I found:

Windows error message If you see an ugly ImportError when importing pyzbar on Windows you will most likely need the Visual C++ Redistributable Packages for Visual Studio 2013. Install vcredist_x64.exe if using 64-bit Python, vcredist_x86.exe if using 32-bit Python.

Installing vcredist_x64.exe solved the issue for me.

i get this error and fix it with https://www.microsoft.com/en-gb/download/details.aspx?id=40784 but uninstall pyzbar before!! if not do uninstall, its not work

if you’ve already installed the pyzbr library, first uninstall (pip uninstall pyzbar) & then download the vcredist_x64.exe and install it

For others finding this the link (for me at the moment) for the redistributables is https://www.microsoft.com/en-gb/download/details.aspx?id=40784

It was already installed on my system. I was getting the same error when installing from conda (conda install -c conda-forge pyzbar). What solved for me was to uninstall the conda package (conda remove -c conda-forge pyzbar) and install pyzbar through pip (pip install pyzbar).

Since using pip inside a conda env is not recommended, I grabbed the DLL files (libiconv.dll and libzbar-64.dll) from the pip installation, uninstalled the pip package (pip uninstall pyzbar), installed pyzbar again from conda-forge, and pasted the DLL files into the folder shown in the error message.

That said, how can those DLL files be included in the conda-forge installation?

I spent hours to solving the problem and this worked. Thanks a lot. However, the interesting thing is why these files were not downloaded when installation with conda

For others finding this the link (for me at the moment) for the redistributables is https://www.microsoft.com/en-gb/download/details.aspx?id=40784

thats work