Skip to content

installation failed for Apple Silicon (MacOS M1/M2), with potential solution #28

@yhsong1013

Description

@yhsong1013

Hi pydem team,

I am a MacOS user and failed to install pydem on my Apple Silicon machine with the standard method.
I found that the compile_args.append("-march=x86-64") is hard coded in setup.py, thus any installation from pip or conda would fall. I worked around it by clone the source, modify setup, and install from the source could solve. Just to paste what I did here for your consideration:

1. Prepare dependencies with conda (optional)

I use conda for env management, but this step is totally optional. I follow your instruction of the dependencies

conda create -n pydem python=3.11
conda activate pydem
conda install numpy cython pip wheel setuptools

2. Clone the pyDEM Repository

git clone https://github.com/creare-com/pydem.git
cd pydem

3. Modify setup.py for Apple Silicon Compatibility

In setup.py around line 32, modify to:

compile_args.append("-std=c++17")    # making sure compiler is consistent
import platform
arch = platform.machine()
if arch == "arm64" or arch == "aarch64":
    compile_args.append("-march=armv8-a") # making sure 

After that, I just install from the source code. pip install .

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