Installation and Licensing#
Basic Installation#
You can run the following command to install GAMSPy from PyPI:
pip install gamspy
Building from source#
If you are a MacOS or Linux user (or using a subsystem like WSL in Windows) who is familiar with using the command line, you can continue with building GAMSPy locally by following the instructions below.
Prerequisites#
Building GAMSPy requires the following software installed:
Python 3.8.x or newer
The GAMSPy source code:
git clone git@github.com:GAMS-dev/gamspy.git
Installation#
You can install GAMSPy from source with the following command:
pip install .
Licensing#
GAMSPy comes with a free demo license which lets you generate and solve small models. For more information about GAMS licenses and how to get a new license, check GAMS Licensing.
Installing or updating your license#
A GAMSPy license is a either an ASCII file of six lines or 36 character identification number which is sent to you via e-mail. In order to install your license, all you need to do is to run:
gamspy install license <path_to_ascii_file or identification number>
For machines that are not connected to the internet, to install a license with the information of the node, one can run:
gamspy install license -i <your_license_number>
This option is only available for licenses in identification number format.
Note
GAMS and GAMSPy licenses are different which means one cannot use an existing GAMS license for GAMSPy. We are giving GAMSPy licenses away for free if you already have a full GAMS license (and in many other cases). One should contact support@gams.com (with their GAMS license) to arrange for the delivery of such a GAMSPy license. If you were already using a GAMS license for GAMSPy before v0.13.0, please contract support@gams.com to arrange a GAMSPy license.
Uninstalling your license#
If you don’t want to use your own license, you can uninstall your license with the following command:
gamspy uninstall license
GAMS/Gurobi-Link#
An attempt to use the GAMS/Gurobi solver with a GAMS/Gurobi-Link license but without a properly set up Gurobi license will result in a licensing error with a message describing the problem. To make the GAMS/Gurobi-Link work you do not need to download or install the Gurobi software but only your Gurobi license.
The only thing that you need to do is to set GRB_LICENSE_FILE environment variable with the path of the Gurobi license (gurobi.lic) you generated by using grbgetkey program:
export GRB_LICENSE_FILE=/path/to/gurobi.lic
Then, you can run the gamspy command as usual:
gamspy install license <path_to_your_license_file>
Note
In order to use Gurobi to solve your model, do not forget to specify solver argument to the model.solve.
your model definition
…
…
model.solve(solver=”gurobi”)
Solvers#
GAMSPy comes with default solvers and more solvers can be installed on demand.
Listing Solvers#
In order to list the installed solvers on your machine, you can run either:
gamspy list solvers
or if you want to list all available solvers, you can run the following:
gamspy list solvers --all
The same information can also be reached programmatically via utils module of GAMSPy:
import gamspy as gp
import gamspy_base
print(gp.utils.getInstalledSolvers(gamspy_base.directory))
print(gp.utils.getAvailableSolvers())
Note
All available solver packages can also be found on PyPI.
Installing/Uninstalling New Solvers#
The following command is available for installating new solvers:
gamspy install solver <solver_name>
Similarly, a solver can be uninstalled with:
gamspy uninstall solver <solver_name>
Updating Solvers#
If the solvers in your machine are not up-to-date, you can run:
gamspy update
To update all solvers to a version that is compatible with GAMSPy.
Testing#
Tests are classified into three: unit tests, integration tests and doc tests. The tests can be run with:
python tests/test_gamspy.py
Note
By default, only unit tests are running. To enable integration tests, –integration argument should be provided. Doctests can be enable with –doc argument.