Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

django-spirit[files] python-magic-bin cannot be installed on mac silicon (m3) #331

Open
2af opened this issue Sep 16, 2024 · 5 comments
Open

Comments

@2af
Copy link

2af commented Sep 16, 2024

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)
...
image
image

@2af 2af changed the title django-spirit[files] cannot be installed on mac silicon (m3) django-spirit[files] python-magic-bin cannot be installed on mac silicon (m3) Sep 16, 2024
@nitely
Copy link
Owner

nitely commented Sep 16, 2024

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.

@nitely
Copy link
Owner

nitely commented Sep 16, 2024

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 ahupp/python-magic#294 gets merged and released.

@ddelange
Copy link

ddelange commented Sep 18, 2024

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.

@2af
Copy link
Author

2af commented Sep 29, 2024

@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]

@nitely
Copy link
Owner

nitely commented Sep 29, 2024

if no dev in your project is on Windows, you can just remove it, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants