This is an old revision of the document!
Using the GAMS Python OO API in combination with third party libraries (e.g. pandas) might fail with a segmentation fault on Linux and Mac OS X. This problem occurs if the third party library loads a version of the shared library libstdc++ which is not compatible with the GAMS Python OO API. The solution is to force the loading of the libstdc++ version that is distributed with the GAMS system. This can be done by importing the gams module at the very beginning before all other modules. In order to really make sure that this is really the case it is also required to create an instance of type GamsDatabase (e.g by calling GamsWorkspace.add_database()) since this triggers the loading of the shared library. The following example shows hoe this can be done:
from gams import * if __name__ == "__main__": ws = GamsWorkspace() # create an instance of GamsDatabase in order to make sure the shared library is loaded ws.add_database() # now it should be possible to import pandas import pandas as pd # ... continue with your actual code
Another possible workaround is to convince the third party library to load the GAMS version of libstdc++ by setting the LD_LIBRARY_PATH or the DYLD_LIBRARY_PATH to the GAMS system directory. All the mentioned solutions are just meant as workarounds. A better fix to the problem is to update the operating system to a newer version that comes with up-to-date system libraries.