'Issue migrating on m1 mac: geos incompatible architecture
I have run through a setup and I'm having issues migrating my app (within my venv). When I run python manage.py migrate
I recevie this error:
OSError: dlopen(/opt/homebrew/opt/geos/lib/libgeos_c.dylib, 0x0006):
tried: '/opt/homebrew/opt/geos/lib//libgeos_c.dylib' (mach-o file, but is
an incompatible architecture (have 'arm64', need 'x86_64')),
'/opt/homebrew/opt/geos/lib/libgeos_c.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/opt/homebrew/opt/geos/lib//libgeos_c.1.16.0.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/opt/homebrew/Cellar/geos/3.10.2/lib/libgeos_c.1.16.0.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
I've tried the answers to this question (missing libgeos_c.so on OSX), but none of them are working for me. I've also tried adding export DYLD_LIBRARY_PATH=/opt/homebrew/opt/geos/lib/
to my ~/.bash_profile.
The output of file /opt/homebrew/Cellar/geos/3.10.2/lib/libgeos.dylib
=
/opt/homebrew/Cellar/geos/3.10.2/lib/libgeos.dylib: Mach-O 64-bit dynamically linked shared library arm64
The output of file $(which python3)
=
/Users/danieljohnson/Documents/code/project/venv/bin/python3 (for architecture x86_64): Mach-O 64-bit executable x86_64
/Users/danieljohnson/Documents/code/project/venv/bin/python3 (for architecture arm64): Mach-O 64-bit executable arm64
I'm not sure where to go from here.
Solution 1:[1]
The main issue I was having was due to the fact that I had mulitple python versions/architectures installed on the venv and the venv was selecting different pythons. My solution was to delete the venv and create a new one with just python 3.8
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Daniel Johnson |