-
Notifications
You must be signed in to change notification settings - Fork 116
Description
Code sample or context
import message_ix
Running this command in PowerShell works:
gams -> returns version and license info
But message-ix cannot detect GAMS:
message-ix show-versions
And when running:
scenario.solve()
it throws a java.lang.UnsatisfiedLinkError
ixmp: 3.11.1
message_ix: 0.0.0
message_ix_models: (not installed)
message_data: (not installed)
click: 8.2.1
dask: 2025.7.0
genno: 1.28.2
graphviz: (not installed)
ixmp4: (not installed)
jpype: 1.6.0
Java VM path: C:\Users\liujiayan\.conda\envs\messageix1\Library\lib\jvm\bin\server\jvm.dll
openpyxl: 3.1.5
pandas: 2.3.1
pint: 0.24.4
xarray: 2025.7.1
yaml: 6.0.2
iam_units: 2023.9.12
jupyter: 5.8.1
matplotlib: 3.10.3
plotnine: 0.15.0
pyam: 1.6.0
GAMS: no 'gams' executable in IXMP_GAMS_PATH=(not set) or the system PATH
system dir: C:\Users\Administrator
python: 3.13.5 | packaged by conda-forge | (main, Jun 16 2025, 08:20:19) [MSC v.1943 64 bit (AMD64)]
python-bits: 64
OS: Windows
OS-release: 2019Server
machine: AMD64
processor: Intel64 Family 6 Model 143 Stepping 8, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: ('Chinese (Simplified)_China', '936')
I also tried the workaround from issue #523, modifying the gams.py file to explicitly locate the GAMS executable using shutil.which()`:
import os
from subprocess import check_output
gams_exec = os.getenv("GAMS_EXECUTABLE", "gams")
if os.name == "nt":
import shutil
found = shutil.which(gams_exec)
if found:
gams_exec = found
else:
gams_exec = "gams"
cmd = f'{gams_exec} null.gms -LogOption=3'
else:
cmd = [gams_exec, "null.gms", "-LogOption=3"]
output = check_output(
cmd,
shell=os.name == "nt",
cwd=".", # or temp_dir
universal_newlines=True,
)
print(output)
The workaround above runs fine in isolation, but the original issues remain.
Expected result
message-ix show-versions
should correctly detect the installed GAMS executable.
scenario.solve()
should execute without throwing a Java `UnsatisfiedLinkError.
Problem description
I'm using message-ix
on a Windows Server environment. GAMS is installed, added to the system PATH, and runs fine from PowerShell. However, when running message-ix show-versions
, it reports that GAMS cannot be found. In addition, solving a scenario fails with:
java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: no utiljni64 in java.library.path: D:\messageix\apifiles\Java\api;C:\Users\liujiayan\.conda\envs\messageix1\Lib\site-packages\ixmp\backend\jdbc\AMD64
Even though utiljni64.dll
exists in D:\GAMS\48\apifiles\Java\api
, and this path is included in the system environment variables (and verified via echo %PATH%
).
I’ve restarted VS Code and the Conda environment, but the problem persists. Is this related to how Java resolves native libraries on Windows, or is there a specific way to configure ixmp
or message-ix
for Windows Server?
Versions
Output of ixmp show-versions
GAMS not found in PATH
Other relevant versions:
- Windows Server 2019
- Python 3.13.5 (Conda env:
messageix1
) - ixmp:3.11.1
- message-ix: 0.0.0
- GAMS: 48.2
- Java: from GAMS installation
- VS Code + PowerShell terminal