ampl / amplpy

Python API for AMPL
https://amplpy.ampl.com
BSD 3-Clause "New" or "Revised" License
64 stars 19 forks source link

Setup workaround on M1 and Docker #48

Closed aphi closed 2 years ago

aphi commented 2 years ago

Running within a generic docker container (python:3.7) on M1, I was having build issues.

Try to install via pip or via setup.py directly would fail on linking to the libampl.so, since the architecture was inferred incorrectly, i.e.

/usr/bin/ld: skipping incompatible amplpy/amplpython/cppinterface/lib/amd64/libampl.so when searching for -lampl
/usr/bin/ld: cannot find -lampl

Following the "clone and setup.py" method failed because it uses platform.processor() which is an empty string on M1 within Docker. However, platform.machine() works. image

This PR just adds platform.machine() as a backup for the cases where platform.processor() is an empty string when determining the ARCH variable. This enabled the setup to find correct .so and enabled me to install the package.

I also changed the link for the git clone. Accessing via git@github.com seems to need elevated access and fails for me, while git clone of https always works.

fdabrandao commented 2 years ago

Hi Antony,

Thank you for your contribution! Do you have access to aarch64 ampl and solvers already?