NaturalHistoryMuseum / pyzbar

Read one-dimensional barcodes and QR codes from Python 2 and 3.
MIT License
724 stars 175 forks source link

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

Open giacomomarchioro opened 3 years ago

giacomomarchioro commented 3 years ago

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

lucenelletenebre commented 3 years ago

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.

GadgetSteve commented 3 years ago

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

gutierrezps commented 3 years ago

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?

khAja13 commented 2 years ago

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.

Thanks mate, it solved me.

nlhnt commented 2 years ago

This doesn't seem to be the case always.
I installed the package from pypi and then it worked... I have vcredist installed and it still gave the error.
Conda allows one to resolve such dependencies (as opposed to pypi) so maybe this could use some investigation?

What I mean it is kind of bizzare to see pypi version work and the conda one not (usually it is the other way around).

reyniel26 commented 2 years ago

vcredist_x64.exe if using 64-bit Python

This help me a lot

flavves commented 2 years ago

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

emingunes1 commented 2 years ago

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

Stoney256 commented 1 year ago

vcredist_x64.exe method worked for me

rrizwan98 commented 1 year ago

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

sour-lollipop commented 1 year ago

метод установки файла vcredist_x64.exe сработал у меня. Спасибо

MeravYitzchak commented 1 year ago

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

vinoj20 commented 1 year ago

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.

GitHubHun commented 1 year ago

完美解决了 89822D38AB234E4A2EC1836C3E79B89E

tieubaoboo commented 11 months ago

thankkkk

niksbanna commented 4 months ago

downloading this solved my issue. https://www.microsoft.com/en-US/download/details.aspx?id=40784

SevaShpun commented 2 months ago

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

Thanks bro! ♥

itsabdullah15 commented 2 months ago

My issue is also solved by installing vcredist_x64.exe this, Thank you :)

MarcSue28 commented 1 month ago

x64 12.0.40664 Microsoft.VCRedist.2013.x64 try to install this specific version https://gist.github.com/ChuckMichael/7366c38f27e524add3c54f710678c98b