CAChemE / pyomo-recipes

Useful conda recipes for Pyomo and dependencies.
MIT License
6 stars 2 forks source link

GLPK #6

Closed franktoffel closed 8 years ago

franktoffel commented 8 years ago

The current recipe does not include the GLPK binaries in the system path:

[pyomo35] C:\Users\franz\Documents\GitHub\pyomo-instalacion\test_example\LP>pyomo solve --solver=glpk diet1.py diet.dat
[    0.00] Setting up Pyomo environment
[    0.00] Applying Pyomo preprocessing actions
[    0.01] Creating model
[    0.06] Applying solver
WARNING: "[base]\pyomo-4.2.10784-py3.5.egg\pyomo\solvers\plugins\solvers\GLPK_old.py", 68, executable
        Could not locate the 'glpsol' executable, which is required for solver 'glpk'
[    0.07] Pyomo Finished
ERROR: Unexpected exception while running model:
        No executable found for solver 'glpk'

Solution is to install GLPK with the following anaconda package: https://anaconda.org/snorfalorpagus/glpk

conda install -c https://conda.anaconda.org/snorfalorpagus glpk

astrojuanlu commented 8 years ago

No problems making people installing packages from two channels (just an extra step), but for the sake of completeness would you tell me if this recipe worked for you then?

https://github.com/snorfalorpagus/conda-recipes/tree/master/glpk

If it does we can include it here, it even has some testing :tada:

astrojuanlu commented 8 years ago

By the way, I think I know why it doesn't work. The current recipe is copying the binary to the wrong location:

https://github.com/CAChemE/pyomo-recipes/blob/683f21d/glpk/bld.bat#L10

Whereas the other recipe is effectively using conda environment variable LIBRARY_BIN (see http://conda.pydata.org/docs/building/environment-vars.html):

https://github.com/snorfalorpagus/conda-recipes/blob/116af80/glpk/bld.bat#L5

astrojuanlu commented 8 years ago

GLPK works now!