pythonjupyter-notebookgoogle-colaboratorypyomoglpk

Install GLPK on Google Colab for python


I want to use Pyomo in Google Colab.

I did this:

pip install pyomo #works 100%
pip install glpk  #error

the error is:

ERROR: Failed building wheel for glpk Running setup.py clean for glpk Failed to build glpk ERROR: Could not build wheels for glpk which use PEP 517 and cannot be installed directly


Solution

  • Usually we recommend installing glpk using conda. I'm not sure if Google Colab has conda installed but if so the command would be:

    conda install -c conda-forge glpk
    

    Also, I recommend taking a look at Chapter 1 of the Pyomo cookbooks here which describe how to set up solvers to use with Pyomo and include notebooks that can be run in Google Colab.