Bug report: ImportError: failed to find libmagic. Check your installation
stephanecollot opened this issue · 6 comments
Hi
With Python 3.8, after installing current version I get:
$ yamlfixer conf/
Traceback (most recent call last):
File "/Users//miniconda3/envs/py38/bin/yamlfixer", line 5, in <module>
from yamlfixer.__main__ import run
File "/Users//miniconda3/envs/py38/lib/python3.8/site-packages/yamlfixer/__main__.py", line 24, in <module>
from .yamlfixer import YAMLFixer
File "/Users//miniconda3/envs/py38/lib/python3.8/site-packages/yamlfixer/yamlfixer.py", line 25, in <module>
from .filefixer import FileFixer
File "/Users//miniconda3/envs/py38/lib/python3.8/site-packages/yamlfixer/filefixer.py", line 23, in <module>
import magic
File "/Users//miniconda3/envs/py38/lib/python3.8/site-packages/magic/__init__.py", line 209, in <module>
libmagic = loader.load_lib()
File "/Users//miniconda3/envs/py38/lib/python3.8/site-packages/magic/loader.py", line 49, in load_lib
raise ImportError('failed to find libmagic. Check your installation')
ImportError: failed to find libmagic. Check your installation
@stephanecollot thanks for your feedback.
Sorry my bad, I thought that installing python-magic
would automatically install libmagic1
, but it doesn't seem to be the case, so I'll update the documentation as well as the code to fail more gracefully, or even better to not fail at all.
What is strange is that on your system libmagic1
is not already installed, however the file
command line tool, which depends on this library, is installed on the vast majority of systems I've encountered so far : it's a pretty standard utility, upon which a lot of other utilities are built. I'm curious to know a bit more about your environment if you don't mind...
In the meantime please refer to python-magic's README which explains its prerequisites.
Thank you, fyi I'm was on Mac.
Hi guys @stephanecollot @tamere-allo-peter : do you think #64 could have allowed us to avoid that issue... or a brew
based package ?
@adriens : I don't think so, but anyway this library is not needed anymore.