projectsyn/commodore

Required dependency libmagic not present on macOS

anothertobi opened this issue · 2 comments

The latest version of commodore (1.15.1) requires libmagic. On macOS, libmagic is not available by default.

Steps to Reproduce the Problem

On macOS Ventura (13.2.1):

  1. python3 -m venv venv
  2. source venv/bin/activate
  3. pip install --upgrade syn-commodore

Actual Behavior

commodore --version

/Users/tobi/Library/Python/3.9/lib/python/site-packages/requests/__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.6) or chardet (5.1.0)/charset_normalizer (2.0.4) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported "
Traceback (most recent call last):
  File "/Users/tobi/Library/Python/3.9/bin/commodore", line 5, in <module>
    from commodore.cli import main
  File "/Users/tobi/Library/Python/3.9/lib/python/site-packages/commodore/cli/__init__.py", line 13, in <module>
    from .catalog import catalog_group
  File "/Users/tobi/Library/Python/3.9/lib/python/site-packages/commodore/cli/catalog.py", line 8, in <module>
    from commodore.catalog import catalog_list, Migration
  File "/Users/tobi/Library/Python/3.9/lib/python/site-packages/commodore/catalog.py", line 17, in <module>
    from .helpers import (
  File "/Users/tobi/Library/Python/3.9/lib/python/site-packages/commodore/helpers.py", line 20, in <module>
    from kapitan import targets as kapitan_targets
  File "/Users/tobi/Library/Python/3.9/lib/python/site-packages/kapitan/targets.py", line 25, in <module>
    from kapitan.dependency_manager.base import fetch_dependencies
  File "/Users/tobi/Library/Python/3.9/lib/python/site-packages/kapitan/dependency_manager/base.py", line 19, in <module>
    from kapitan.utils import (
  File "/Users/tobi/Library/Python/3.9/lib/python/site-packages/kapitan/utils.py", line 12, in <module>
    import magic
  File "/Users/tobi/Library/Python/3.9/lib/python/site-packages/magic/__init__.py", line 209, in <module>
    libmagic = loader.load_lib()
  File "/Users/tobi/Library/Python/3.9/lib/python/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

Expected Behavior

Commodore version printed

simu commented

IIRC @rxbn was able to fix this issue by installing libmagic via brew (see also Yelp/elastalert#1927 (comment))

rxbn commented

@anothertobi For me, it was enough to just run brew install libmagic.