2

I believe this may be a general python/gcc problem not specific to pyglpk.

I'm trying install to pyglpk on a fresh install of Ubuntu 14.04. As I'm using a fresh install of Ubuntu both Python 2.7 and 3 are installed. I believe I've properly installed the listed required dependencies (GLPK and GMP) and I've installed the additional dependencies which another post suggested I might be missing:

apt-get install python-dev libxml2-dev libxslt-dev

Here is the error i get when trying to compile pyglpk:

sudo make
python setup.py build
running build
running build_ext
building 'glpk' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -Isrc -I/usr/include/python2.7 -c src/glpk.c -o build/temp.linux-x86_64-2.7/src/glpk.o -m32
In file included from /usr/include/python2.7/Python.h:8:0,
                 from src/glpk.c:20:
/usr/include/python2.7/pyconfig.h:7:49: fatal error: i386-linux-gnu/python2.7/pyconfig.h: No such file or directory
 #  include <i386-linux-gnu/python2.7/pyconfig.h>
                                                 ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
make: *** [all] Error 1

It looks to me like the actual file it's looking for (pyconfig.h) is here:

/usr/include/x86_64-linux-gnu/python2.7/pyconfig.h

while make/gcc seems to be looking for the equivalent file for 32 bit python:

/usr/include/i386-linux-gnu/python2.7/pyconfig.h

I'm going to try installing 32 bit Ubuntu instead, even though I should be able to use 32 bit programs on a 64 bit system. I'll report back here.

Thanks!

i3rendn4v05
  • 539
  • 1
  • 4
  • 12
  • 1
    If you're going to vote the post down please leave an explanation of how my post does not show research effort, is not clear, or is not helpful. I have researched this problem to the best of my ability and have provided what I believe to be a comprehensive and clear description of the problem at hand. – i3rendn4v05 Feb 27 '16 at 23:00
  • Consider posting this question at https://askubuntu.com/. I would also suggest you to install 32-bit libraries, e.g., `ia32-libs`, and don't forget to `sudo dpkg --add-architecture i386` – serge_k Feb 28 '16 at 06:45
  • Intriguing. Thanks for your advice! I'm now temped to revert back to 64 bit to give this a try. I've installed and reinstalled Ubuntu far too many times over the past 3 days! – i3rendn4v05 Feb 28 '16 at 07:18
  • No, that didn't work. It's looking for a 32 bit version of python itself, which would require me to install 32 bit python along side 64 bit (which seems to be quite a messy process). – i3rendn4v05 Feb 28 '16 at 09:35

2 Answers2

2

I have finally gotten PyGLPK working!

I was able to "solve"fatal error: i386-linux-gnu/python2.7/pyconfig.h: No such file or directory by installing 32 bit Ubuntu instead of 64 bit.
I would not recommend trying to install the 32 bit version of python on 64 bit Ubuntu as that opens up another huge plethora of issues.
If you know how to fix this error on 64 bit Ubuntu please speak up!


Once I got past that error I experienced a new error:
ImportError: libglpk.so.0: cannot open shared object file: No such file or directory
I discovered that part of this error is the due to PyGLPK being quite old. The newest version of PyGLPK (v. 0.3) is not compatible with the newest version of GLPK (v 4.58). This post suggested GLPK v 4.47 was the last working version compatible with PyGLPK, which seems to be working fine.
After installing GLPK v 4.47 the error still appears to occur. I've found that installing python-glpk using the command sudo apt-get install python-glpk fixes the error. I believe this is because installing python-glpk also installs some dependency which is also necessary for PyGLPK, because even after uninstalling python-glpk PyGLPK continues to work.
I can confirm that following this step while using GLPK v. 4.58 does not work. An older version of GLPK and whatever dependency python-glpk installs are both required.

Community
  • 1
  • 1
i3rendn4v05
  • 539
  • 1
  • 4
  • 12
-1

I had the exact same error/situation (64 bit linux mint, I'm sorry if its somehow different, total noob here). GLPK 4.55. This version works out the box: https://github.com/bradfordboyle/pyglpk Hope this helps.