Building and Installing

Building this module requires that the user have installed the GLPK 4.18 or later, and GMP libraries. The module builds and appears to work on my simple test files in Python 2.4 and 2.5. Earlier versions of Python may not work. I have developed this on both OS X and Linux. I do not know if it will work on Windows.

Here are the brief instructions for installing.

In the ideal case (that is, you have GLPK and GMP libraries, headers, executables and the like installed in default search paths), this will just work.

Troubleshooting

A few details just in case things don't go that easily:

How PyGLPK builds depends on which version of GLPK is installed. GLPK is an evolving library, and some functionality has been added only since older versions.

If You're Having Trouble Building

Below are some suggestions to try or avenues to pursue if you're having trouble building. This is not an exhaustive list, just "the most likely suspects."

If You're Having Trouble Testing

Once you have built the module successfully and there is a glpk.so symbolic link defined to the shared library, you should run the principle test suite through make test.

If you're running the test suite through make test and it throws some sort of exception, what the problem is depends on what type of error you see.

ImportError: No module named glpk
Ensure that the module actually built.
ImportError: (stuff) Symbol not found
Most likely, it cannot find a required library. Run ldd glpk.so (on Linux) or otool -L glpk.so (on OS X) to see which libraries it cannot find. Use this information to ensure that you environment variable LD_LIBRARY_PATH points to directories containing appropriate libraries. (Note that merely finding all libraries is not necessarily sufficient in the case where there are multiple GLPK libraries floating around. Ensure you're not building with one, but running with the other.)
AssertionError (or other error)
The good news is that the module appears to load and run and it's throwing normal Python exceptions. The bad news is one of my tests failed. This should not happen, but if it does, send me a bug report.

If You're Having Trouble Installing

If it says permission denied when running make install, perhaps you need to run the command as the superuser, e.g., sudo make install .

Uninstalling

Like many Python modules, PyGLPK builds itself with the aid of Python's included distutils module. As of the time of this writing, distutils does not support uninstallation. I am not comfortable with writing my own solution. Given that this is a potentially destructive option, there may be unintended, unfortunate consequences on some person's configuration I did not anticipate. However, one may still uninstall PyGLPK by importing the glpk module, and checking the glpk.__file__ attribute. This will tell you where the module file is stored. Then, you can go to that directory and remove the module file, and the associated egg-info file, and rid yourself of PyGLPK.
Thomas Finley, 2007, 2008