django-spirit[files] python-magic-bin cannot be installed on mac silicon (m3)
Python 3.11.7 (same as 3.12.5) pip 24.2 crashing library - python-magic-bin
Attempt1:
this requirements.txt CRASHES on an Apple Silicon M3 MAC:
this requirements.txt WORKS on an INTEL MAC:
requirements.txt:
Django==4.2.7
django-spirit==0.13.0
django-spirit[files]
INFO: pip is looking at multiple versions of django-spirit[files] to determine which version is compatible with other requirements. This could take a while. ERROR: Could not find a version that satisfies the requirement python-magic-bin==0.4.14; extra == "files" (from django-spirit[files]) (from versions: none) ERROR: No matching distribution found for python-magic-bin==0.4.14; extra == "files"
Attempt2:
requirements.txt:
Django==4.2.7
# django-spirit==0.13.0
django-spirit[files]
INFO: pip is looking at multiple versions of django-spirit[files] to determine which version is compatible with other requirements. This could take a while.
Collecting django-spirit[files] (from -r app/requirements.txt (line 61))
Using cached django-spirit-0.12.3.tar.gz (2.4 MB)
...
This should work:
Django==4.2.7
django-spirit==0.13.0
python-magic==0.4.27
You'll need to install libmagic, see https://github.com/ahupp/python-magic?tab=readme-ov-file#installation
brew install libmagic
or
port install file
Then start Spirit and try to upload some file in a comment to check it works.
django-spirit[files] just installs python-magic-bin which should only be needed in Windows.
The above should work, and I should change this https://github.com/nitely/Spirit/blob/master/setup.py#L22 to match windows only.
Alternative:
pip install git+https://github.com/ddelange/python-magic.git@abi3-wheels --force-reinstall --find-links https://github.com/ddelange/python-magic/releases/expanded_assets/0.4.28.post7
Until https://github.com/ahupp/python-magic/pull/294 gets merged and released.
you don't need the git+ vcs link, you can use (unreleased) python-magic>=0.4.28 in your requirements (regardless of platform) and export PIP_FIND_LINKS=https://github.com/ddelange/python-magic/releases/expanded_assets/0.4.28.post7 before running your pip install command. I added the --force-reinstall in the PR description to avoid re-using broken existing wheels/installations. doing so on pypi however will break install for anyone who doesn't export the env var.
@nitely
Django==4.2.7 django-spirit==0.13.0 python-magic==0.4.27
It worked, thank you! Should I remove this line from the requirements.txt: django-spirit[files]
if no dev in your project is on Windows, you can just remove it, yes.