bakun
bakun

Reputation: 475

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

Upvotes: 1

Views: 5284

Answers (3)

Sarka Pribylova
Sarka Pribylova

Reputation: 1

I ran these two commands in google colab and all works well:

!pip install -q pyomo
!apt-get install -y -qq glpk-utils

Upvotes: 0

korakot
korakot

Reputation: 40838

Need to use both apt and pip to install it.

!pip install pyomo
!apt install glpk-utils
!pip install glpk

Upvotes: 4

Bethany Nicholson
Bethany Nicholson

Reputation: 2828

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.

Upvotes: 4

Related Questions