I am trying to install the Python API on a Linux server. Python is installed server and I do not have writing access to the standard “site-packages” folder. I thus need to install to the user “site-packages” folder. When I use the option for this in calling setup.py, i.e.,
python setup.py install --user
in the bash (in folder in which API files are located), I get an error message:
as this is the path to the server “site-packages” folder.
I tried running the different setup files for the low level packages (gdxcc etc.) and these packages correctly install in the user “site-packages” folder. Finally running gamsxsetup.py also works, but when I try to import the gams package, I get an import error:
Thank you for providing the “–user” problem. We will look into this and see how to fix this. Most likely it is a problem in our setup scripts. Note that you can also always set the PYTHONPATH in order to tell the Python interpreter where to look for modules.
The actual problem you are facing now is a mismatch between the Unicode setting of the Python interpreter and the GAMS Python API. We distribute the GAMS Python API in binary files which use UCS4 on Mac and Linux. Therefore sysconfig.get_config_var(‘Py_UNICODE_SIZE’) should evaluate to 4. An alternative way to check the unicode settings is as follows:
The unicode versions of the API and the Python interpreter need to match. The only solution is to use an appropriate version of the Python interpreter. You might need to install a UCS4 prebuild package for Linux or even build Python from source. The important flag that triggers UCS4 is --enable-unicode=ucs4.