Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: [WinError 126] Cannot find the specified module. #13

Closed
boyden opened this issue Feb 17, 2018 · 8 comments
Closed

OSError: [WinError 126] Cannot find the specified module. #13

boyden opened this issue Feb 17, 2018 · 8 comments

Comments

@boyden
Copy link

boyden commented Feb 17, 2018

I have successfully use the command pip install pyzbar and installed it, but when I type from pyzbar.pyzbar import decode, I get the following error:OSError: [WinError 126] Cannot find the specified module.

The whole info is as follows:

OSError Traceback (most recent call last)
c:\users\acer\appdata\local\programs\python\python36\lib\site-packages\pyzbar-0.1.4-py3.6.egg\pyzbar\wrapper.py in load_libzbar()
127 try:
--> 128 loaded_dependencies, libzbar = load(Path(''))
129 except OSError as e:

c:\users\acer\appdata\local\programs\python\python36\lib\site-packages\pyzbar-0.1.4-py3.6.egg\pyzbar\wrapper.py in load(dir)
121 cdll.LoadLibrary(str(dir.joinpath(dep)))
--> 122 for dep in dependencies
123 ]

c:\users\acer\appdata\local\programs\python\python36\lib\site-packages\pyzbar-0.1.4-py3.6.egg\pyzbar\wrapper.py in (.0)
121 cdll.LoadLibrary(str(dir.joinpath(dep)))
--> 122 for dep in dependencies
123 ]

c:\users\acer\appdata\local\programs\python\python36\lib\ctypes_init_.py in LoadLibrary(self, name)
425 def LoadLibrary(self, name):
--> 426 return self._dlltype(name)
427

c:\users\acer\appdata\local\programs\python\python36\lib\ctypes_init_.py in init(self, name, mode, handle, use_errno, use_last_error)
347 if handle is None:
--> 348 self._handle = _dlopen(self._name, mode)
349 else:

OSError: [WinError 126] 找不到指定的模块。

During handling of the above exception, another exception occurred:

OSError Traceback (most recent call last)
in ()
----> 1 from pyzbar.pyzbar import decode

c:\users\acer\appdata\local\programs\python\python36\lib\site-packages\pyzbar-0.1.4-py3.6.egg\pyzbar\pyzbar.py in ()
6
7 from .pyzbar_error import PyZbarError
----> 8 from .wrapper import (
9 zbar_image_scanner_set_config,
10 zbar_image_scanner_create, zbar_image_scanner_destroy,

c:\users\acer\appdata\local\programs\python\python36\lib\site-packages\pyzbar-0.1.4-py3.6.egg\pyzbar\wrapper.py in ()
164 c_int,
165 c_uint_p, # major,
--> 166 c_uint_p, # minor
167 )
168

c:\users\acer\appdata\local\programs\python\python36\lib\site-packages\pyzbar-0.1.4-py3.6.egg\pyzbar\wrapper.py in zbar_function(fname, restype, *args)
157 """
158 prototype = CFUNCTYPE(restype, *args)
--> 159 return prototype((fname, load_libzbar()))
160
161

c:\users\acer\appdata\local\programs\python\python36\lib\site-packages\pyzbar-0.1.4-py3.6.egg\pyzbar\wrapper.py in load_libzbar()
128 loaded_dependencies, libzbar = load(Path(''))
129 except OSError as e:
--> 130 loaded_dependencies, libzbar = load(Path(file).parent)
131 else:
132 # Assume a shared library on the path

c:\users\acer\appdata\local\programs\python\python36\lib\site-packages\pyzbar-0.1.4-py3.6.egg\pyzbar\wrapper.py in load(dir)
120 deps = [
121 cdll.LoadLibrary(str(dir.joinpath(dep)))
--> 122 for dep in dependencies
123 ]
124 libzbar = cdll.LoadLibrary(str(dir.joinpath(fname)))

c:\users\acer\appdata\local\programs\python\python36\lib\site-packages\pyzbar-0.1.4-py3.6.egg\pyzbar\wrapper.py in (.0)
120 deps = [
121 cdll.LoadLibrary(str(dir.joinpath(dep)))
--> 122 for dep in dependencies
123 ]
124 libzbar = cdll.LoadLibrary(str(dir.joinpath(fname)))

c:\users\acer\appdata\local\programs\python\python36\lib\ctypes_init_.py in LoadLibrary(self, name)
424
425 def LoadLibrary(self, name):
--> 426 return self._dlltype(name)
427
428 cdll = LibraryLoader(CDLL)

c:\users\acer\appdata\local\programs\python\python36\lib\ctypes_init_.py in init(self, name, mode, handle, use_errno, use_last_error)
346
347 if handle is None:
--> 348 self._handle = _dlopen(self._name, mode)
349 else:
350 self._handle = handle

OSError: [WinError 126] 找不到指定的模块。

@quicklizard99
Copy link
Member

This is almost certainly because a runtime dependency of one of the DLLs (libzbar-64.dll or libiconv.dll on a 64-bit build of Python; libzbar-32.dll or libiconv-2.dll on a 32-bit build) was not found on your system. This will be hard to diagnose precisely without more information but I would guess that the expected Microsoft Visual C runtime DLL is missing from your system.

Could you install this from https://www.microsoft.com/en-US/download/details.aspx?id=40784 and try again?

@gkerekes
Copy link

gkerekes commented Jan 2, 2019

I had the same issue and @quicklizard99 suggestion worked for me

@kyc1109
Copy link

kyc1109 commented Apr 24, 2020

I had the same issue and @quicklizard99 suggestion worked for me

@pablojr1971
Copy link

I had the same issue and @quicklizard99 suggestion worked for me

@SilverLustre
Copy link

SilverLustre commented Dec 2, 2020

I also encountered the same problem. I manually put libiconv.dll and libzbar-64.dll into D:\anaconda3\envs\[your_env_name]\Lib\site-packages\pyzbar, then the problem solved perfectly.

@claybarrett
Copy link

@SilverLustre Where did you find those DLLs? And are you on Windows?

@ayonbasu50
Copy link

Thank you so much I was having the same problem and it is solved by @quicklizard99 suggestion

@andySigler
Copy link

Thank you @quicklizard99, this also fixed my issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants