Repository navigation
ImportError: failed to find libmagic. Check your installation #145
Description
Activity
Yes, your %PATH% environment variable.
Now i have this Error:
``
import magic
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\site-packages\magic.py", line 154, in
libmagic = ctypes.CDLL(dll)
File "C:\Python27\lib\ctypes_init_.py", line 353, in init
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found
``I install python-magic using
pip install magic-pythonand i can see files on pythonsite-packagesinstallation directory.What's wrong?
and a question: : we must pass location ofmagicfile (from[binary-zip]\share\misc) toMagic(magic_file=...)? Like this below code?f = magic.Magic(mime=True, uncompress=True,magic_file="./mymagicfile/magic")No, the magic_file argument won't help here. It's failing to load the libmagic dll for some reason. I generally like to use the "Process Monitor" utility from sysinternals to figure out where it's trying to load DLLs from. Either it's looking in the wrong place, or there's a missing dependency of those dlls.
Is the problem solved?
@Ayla93: to be clear, this is a local install issue rather than a bug in the library. Are you seeing the same issue as @CarlGalloy ?
Where is the magic1.DLL and regex located in windows 10. I'm having the same import error.
Please help me out.Those are 3rd party libraries you'll have to install. The README file includes some pointers to them, and I've updated it with more info.
For me i faced this issue when I import magic library in my django application. I solved it by " brew install libmagic" installing libmagic on the system level
Reacted by William Maphanga, Óscar López, Joel and TimI had this issue with official python docker (python:3.7-slim-buster), so I fixed it with
apt-get install libmagic-dev.Reacted by Ye Wang and melyuxI solve this problem with "pip install python-magic-bin"
Reacted by Aliya, Praful and Ashish PatilReacted by PrafulYep, @ashishnitinpatil your comment was very helpful. The official python docker images is missing the (libmagic-dev for Debian based distro, headers, aka dynamic libraries files etc.), so we need to install
libmagic-devto make it work during the runtime (magic checks the dynamic libs). Alternatively, include thepython-magic-binversion which includes those required files.Reacted by Ashish Patil
Hi.
In dependency section mention that "magic1.dll, regex2.dll, and zlib1.dll onto your PATH from the Binaries " where exactly PATH is? ( System Environment PATH? )