LPSolve, Python and Ubuntu?

2.7k views Asked by At

I'm trying to install LP solve 5.5 to use with python 2.7 in ubuntu 13.10 64 bit. I'm at my wits end! :,(

I have python installed.

/home/user/$ python
Python 2.7.5+ (default, Sep 19 2013, 13:48:49) 
[GCC 4.8.1] on linux2

The python path is as follows:

>>> import sys
>>> print sys.path
print sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', '/usr/bin', '/usr/lib/lpsolve/', '/user/lib/']

lp-solve and the liblpsolve55-dev packages installed from ubuntu repos. LP Solve command utility runs as expected.

/home/user/$ lp_solve -h 
Usage of lp_solve version 5.5.0.13:

However lpsolve fails in python,

>>> from lpsolve55 import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named lpsolve55

I have checked that the following files exists.

/usr/bin/lp_solve
/usr/lib/lp_solve/liblpsolve55.so

I suspect I'm missing the python lpsolve55.so driver that can be compiled as outlined in Compile the lpsolve driver. I really don’t know how to do this. I've used LP solve in python on a windows based system before, but I did not have to compile anything.

Please help.

1

There are 1 answers

0
AudioBubble On

I'm not sure if this is still relevant, but I thought I'll post it for future use.

  1. Download the following file from the offical website of lpsolve: lp_solve_5.5.2.0_Python2.5_exe_ux64.tar.gz
  2. Extract its contents to /usr/lib/python2.7/site-packages
  3. Open your Python shell and type from lpsolve55 import *