Skip to content

Project fails to run on development if libmagic C library is not installed on host machine #213

@madewithkode

Description

@madewithkode

The project uses the python-magic package which requires the libmagic C library to be installed on the host machine. If this is not installed, an error like the following is thrown when you try to interact with modules that utilize the package:

ImportError while importing test module '/xocto/tests/storage/test_storage.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/storage/test_storage.py:17: in <module>
    from xocto.storage import s3_select, storage
xocto/storage/storage.py:32: in <module>
    import magic
venv/lib/python3.9/site-packages/magic/__init__.py:209: in <module>
    libmagic = loader.load_lib()
venv/lib/python3.9/site-packages/magic/loader.py:49: in load_lib
    raise ImportError('failed to find libmagic.  Check your installation')
E   ImportError: failed to find libmagic.  Check your installation

We should update the documentation to communicate this and also provide the steps to install libmagic for the major OS platforms.

Hint: The steps are fairly straightforward and are already documented on python-magic's package index page, so can be taken from there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions