Trouble installing Python GAMS API on Mac OS

Hello,

I’m using GAMS version 34.3.0, Mac OS 12.6.5, and Python 3.9. I have tried to install GAMS API via pip (pip install gams) but keep getting a distribution error. I tried to use pip from python 3.8 as well but this error keeps happening. I checked the documentation for version 34.3.0 and it looks like it should work with python 3.8 and 3.9 and OS 12.6. Do you know what else could be the issue here? Thank you very much.

ERROR: Could not find a version that satisfies the requirement gams (from versions: none)
ERROR: No matching distribution found for gams

Hi,

With GAMS 34 the Python API was not installed via pip. Please make sure to use the documenttation that matches your GAMS version. The documentation of GAMS 34 can be found here.

I hope this helps!

Fred

Hi Fred! Thank you! It was very helpful. I did try to follow the tutorial for GAMS 34 and it seemed to work. However, when I tried to run the transport1.py example, I got an error of
mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)

Do you have an idea what the issue is?

Here is my installation process (on Mac OS 12.6.5):

export PYTHONPATH=/Library/Frameworks/GAMS.framework/Versions/34/Resources/apifiles/Python/api_39
export PYTHONPATH=/Library/Frameworks/GAMS.framework/Versions/34/Resources/apifiles/Python/gams:$PYTHONPATH
cd /Library/Frameworks/GAMS.framework/Versions/34/Resources/apifiles/Python/api_39
python3.9 setup.py install

The full error is:

ImportError: dlopen(/Library/Frameworks/GAMS.framework/Versions/34/Resources/apifiles/Python/api_39/_gdxcc.so, 0x0002): tried: '/Applications/FICO Xpress/Xpress Workbench.app/Contents/Resources/xpressmp/lib/_gdxcc.so' (no such file), '/_gdxcc.so' (no such file), '/Library/Frameworks/GAMS.framework/Versions/34/Resources/apifiles/Python/api_39/_gdxcc.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

You have a Mac with an M1 or M2 chip but the GAMS 34 distribution is Intel only. So you would need an Intel Python running under Rosetta 2 on you machine. The native M1/M2 port for GAMS was introduced with GAMS 43 (see https://www.gams.com/latest/docs/RN_43.html#g4310_PLATFORMS). So many good reasons to update to GAMS 43!

-Michael

Thank you for you answer, Michael! My organization does not use the later versions of GAMS unfortunately so I’m stuck with version 34 until getting permission to upgrade. So in this case, it looks like I need to create an X86 version of python by installing Rosetta?

Yes. -Michael