iiasa / ixmp

The ix modeling platform for integrated and cross-cutting scenario analysis
https://docs.messageix.org/ixmp
Apache License 2.0
38 stars 112 forks source link

GAMS is not registered correctly in show-versions #523

Open glatterf42 opened 8 months ago

glatterf42 commented 8 months ago

Code sample or context

Recently, @behnam-zakeri tried to install message-ix again on a new Linux machine. The process went fine by creating a new virtual environment via virtualenv and virtualenvwrapper and we made sure that the directory for gams is in $PATH. This can be confirmed by running gams on the system; it seems to work both from the command line and as part of the westeros_baseline tutorial from message-ix. However, running


message-ix show-versions

tells us that 'gams' is not in PATH. Since everything else is working fine, my expectation is that this is due to an issue with the way that ixmp tries to find gams, not about the installation per se.

We should note that the Linux machine was not a fresh install. Things like pip and virtualenv or even venv were missing, which seems odd.

Expected result

message-ix show-versions, which is internally using https://github.com/iiasa/ixmp/blob/d202e019204e6cf979df6f2a827322a00dbd1957/ixmp/model/gams.py#L18C1-L50C20 should find the correct version of gams.

Problem description

It doesn't seem to find it at all.

Versions

@behnam-zakeri If you can edit this description, please add the output of message-ix show-versions here. Otherwise, please just paste it down below.

Output of ixmp show-versions ``` ```
khaeru commented 8 months ago

One way to debug this is to put for instance:

    print(os.environ)

    # Execute, capturing stdout
    output = check_output(
        ...
    )

    print(output)

…around the subject code.

Setting PATH can have some subtleties. For instance, if setting the value in .profile or a similar file, the value will appear in all new terminals opened after that addition. But if one has a terminal open prior, and does not do anything in it, then its prior value of PATH is not automatically updated.