Hi,
I am trying to run a GAMS model from Python using the gamsapi package. I keep getting this error “GamsException: Error reading config file …gmscmpnt.txt” when I try to run it using my gams (with a real license). But I don’t have the issue when using the demo version.
Can anyone help with this ? I am not finding any answer elsewhere.
Hi,
Can you share the full log and lst file?
Does this issue occur with any model, e.g. trnsport from the model library?
If you do not want to share the information publicly, feel free to reach out to support@gams.com.
Fred
Hi,
I am having the error when using the trnsport model or my own model !
The full error message is the following :
GamsException Traceback (most recent call last)
Cell In[2], line 4
2 cp = ws.add_checkpoint()
3 job = ws.add_job_from_file(“…”)
----> 4 job.run(checkpoint=cp)
5 mi = cp.add_modelinstance()
File …\AppData\Local\Programs\Python\Python312\Lib\site-packages\gams\control\execution.py:986, in GamsJob.run(self, gams_options, checkpoint, output, create_out_db, databases)
976 def run(self, gams_options=None, checkpoint=None, output=None, create_out_db=True, databases=None):
977 ‘’’
978 @brief Run GamsJob
979 @param gams_options GAMS options to control job
(…)
983 @param databases Either a GamsDatabase or a list of GamsDatabases to be read by the GamsJob
984 ‘’’
→ 986 tmp_cp, tmp_opt, pf_file_name, _ = self._prepare_run(
987 gams_options, checkpoint, output, create_out_db, databases)
989 capture_output = self._workspace._debug >= gams.control.workspace.DebugLevel.ShowLog or output
990 stdout_val = None
File …\Local\Programs\Python\Python312\Lib\site-packages\gams\control\execution.py:884, in GamsJob._prepare_run(self, gams_options, checkpoint, output, create_out_db, databases, relative_paths)
882 def _prepare_run(self, gams_options=None, checkpoint=None, output=None, create_out_db=True, databases=None, relative_paths=False):
883 tmp_cp = None
→ 884 tmp_opt = GamsOptions(self._workspace, gams_options)
886 if self._checkpoint_start:
887 if relative_paths:
File …\AppData\Local\Programs\Python\Python312\Lib\site-packages\gams\control\options.py:2352, in GamsOptions.init(self, ws, opt_from, opt_file)
2349 conf_file = “gmscmpun.txt”
2351 if cfgReadConfigGUC(self._cfg, self._workspace._system_directory + os.sep + conf_file, self._workspace._system_directory):
→ 2352 raise gams.control.workspace.GamsException(“Error reading config file” + self._workspace._system_directory + os.sep + conf_file)
2354 if opt_from:
2355 #TODO: mktemp is depricated, but mkstemp created a file and we don’t want that
2356 pf_file_name = tempfile.mktemp(prefix=self._workspace.scratch_file_prefix, dir=self._workspace._working_directory)
GamsException: Error reading config file …gmscmpnt.txt
This is what the config file looks like :
- GAMS Solver Capabilities File *
BARON 100000 0 0 LP MIP RMIP NLP CNS DNLP RMINLP MINLP
gmsba_nt.cmd
BDMLP 1 0 1 LP MIP RMIP
gmsbd_nt.cmd
gmsbd_nx.exe
CONOPT 1 0 1 LP RMIP NLP CNS DNLP RMINLP
gmsco2nt.cmd
gmsco2nx.exe
CONOPT1 1 0 1 LP RMIP NLP DNLP RMINLP
gmsco_nt.cmd
gmsco_nx.exe
CONOPT2 1 0 1 LP RMIP NLP CNS DNLP RMINLP
gmsco2nt.cmd
gmsco2nx.exe
CONOPT3 1 0 1 LP RMIP NLP CNS DNLP RMINLP
gmsco3nt.cmd
gmsco3nx.exe
CONVERT 100000 0 1 LP MIP RMIP NLP MCP CNS DNLP RMINLP MINLP MPEC
gmscv_nt.cmd
gmscv_nx.exe
CPLEX 11 4 1 LP MIP RMIP
gmscp_nt.cmd
gmscp_nx.exe
CPLEXPAR 11 4 1 LP MIP RMIP
gmscppnt.cmd
gmscppnx.exe
CPLEXPSLP 11 4 1 LP MIP RMIP NLP DNLP RMINLP
gmscplnt.cmd
gmscplnx.exe
CPLEXSLP 11 4 1 LP MIP RMIP NLP DNLP RMINLP
gmscpsnt.cmd
gmscpsnx.exe
DECISC 2011 4 0 LP
gmsdecnt.cmd
DECISM 2011 4 0 LP
gmsdemnt.cmd
DICOPT 1 0 1 MINLP
gmsdi_nt.cmd
gmsdi_nx.exe
GAMSBAS 1010 2 1 LP MIP RMIP NLP MCP DNLP RMINLP MINLP
gmsbs_nt.cmd
gmsbshnx.exe
GAMSCHK 101010 4 1 LP MIP RMIP NLP MCP DNLP RMINLP MINLP
gmsck_nt.cmd
gmsckhnx.exe
MILES 100001 4 1 MCP
gmsmcent.cmd
gmsmcenx.exe
MILESE 100001 4 1 MCP
gmsmcent.cmd
gmsmcenx.exe
MILESOLD 100001 2 1 MCP
gmsmc_nt.cmd
gmsmc_nx.exe
MINOS 101 0 1 LP RMIP NLP DNLP RMINLP
gmsmi_nt.cmd
gmsmi_nx.exe
MINOS5 1 0 1 LP RMIP NLP DNLP RMINLP
gmsm5_nt.cmd
gmsm5_nx.exe
MPECDUMP 101111 4 1 LP RMIP NLP MCP CNS DNLP RMINLP MPEC
gmsmd_nt.cmd
gmsmd_nx.exe
MPSGE 100001 2 1
gmsgewnt.cmd
gmsgewnx.exe
MPSWRITE 11 3 1 LP MIP RMIP NLP DNLP RMINLP MINLP
gmsmp_nt.cmd
gmsmp_nx.exe
OSL 1 0 1 LP MIP RMIP
gmsos2nt.cmd
gmsos2nx.exe
OSL1 1 0 1 LP MIP RMIP
gmsos_nt.cmd
gmsos_nx.exe
OSL2 1 0 1 LP MIP RMIP
gmsos2nt.cmd
gmsos2nx.exe
OSL3 11 0 1 LP MIP RMIP
gmsos3nt.cmd
gmsos3nx.exe
OSLSE 101 1 1 LP RMIP NLP
gmsse_nt.cmd
gmsse_nx.exe
PATH 100001 4 1 MCP CNS
gmsptcnt.cmd
gmsptcnx.exe
PATHC 100001 4 1 MCP CNS
gmsptcnt.cmd
gmsptcnx.exe
PATHNLP 111 4 1 LP RMIP NLP RMINLP
gmsptnnt.cmd
gmsptnnx.exe
PATHOLD 1 2 1 MCP
gmspt_nt.cmd
gmspt_nx.exe
SBB 101 0 1 MINLP
gmssb_nt.cmd
gmssb_nx.exe
SNOPT 101 0 1 LP RMIP NLP DNLP RMINLP
gmssn_nt.cmd
gmssn_nx.exe
XA 1 0 1 LP MIP RMIP
gmsxa_nt.cmd
gmsxa_nx.exe
XAPAR 1 0 1 LP MIP RMIP
gmsxm_nt.cmd
gmsxm_nx.exe
XPRESS 1 0 1 LP MIP RMIP
gmsxp_nt.cmd
gmsxp_nx.exe
ZOOM 1 0 1 LP MIP RMIP
gmszo_nt.cmd
gmszo_nx.exe
DEFAULTS
LP BDMLP
MIP BDMLP
RMIP BDMLP
NLP CONOPT
MCP MILES
CNS CONOPT
DNLP CONOPT
RMINLP CONOPT
MINLP DICOPT
Seems that you are using a rather old GAMS system with Python 3.12?
I suggest you get the latest GAMS from https://www.gams.com/download/ and then follow the tutorial.
In general, please make sure to use the documentation that matches your installed version. Especially in the installation process of the Python API, there were several changes in recent years.
I hope this helps!
Fred