Install Python-Glpk

I want to install python-glpk I followed the instructions here:

But when I tried to do this:

import glpk
print glpk.glp_version()

I have these errors

Thank you

1

1 Answer

Bug

For Ubuntu 16.04 LTS it is known issue - it was reported to LaunchPad.net on 2016-10-02 as bug 1629672.

Fix

We can fix this bug by installation of previous version of python-ply component with pip into your home folder:

#sudo apt-get install python-glpk # you did this before in question
sudo apt-get install python-pip
pip install ply==3.4 --user

And then test it with simple script (name it glpk_test.py) with contents:

#!/usr/bin/python2
import glpk
print glpk.glp_version()

then make it executable with chmod +x glpk_test.py and execute with ./glpk_test.py.

The output on Ubuntu 16.04 LTS will be:

4.57
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest