Reputation: 209
I'm trying to install pyglpk-0.3 to use it with cobrapie, the python version of the matlab cobra toolbox. Everytime I start the installation, I get the following errors: (a part of it)
c -I/Users/gadreel/anaconda/include/python2.7 -c src/tree.c -o build/temp.macosx-10.5-x86_64-2.7
/src/tree.o -m32
/usr/bin/clang -fno-strict-aliasing -I/Users/gadreel/anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/include -Isrc -I/Users/gadreel/anaconda/include/python2.7 -c src/environment.c -o build/temp.macosx-10.5-x86_64-2.7/src/environment.o -m32
src/environment.c:80:26: error: unknown type name 'glp_long'
static PyObject* long2py(GLP_LONG l) {
^
src/environment.c:75:18: note: expanded from macro 'GLP_LONG'
#define GLP_LONG glp_long
^
src/environment.c:90:3: error: use of undeclared identifier 'glp_long'
GLP_LONG b;
^
src/environment.c:75:18: note: expanded from macro 'GLP_LONG'
#define GLP_LONG glp_long
^
src/environment.c:91:30: error: use of undeclared identifier 'b'
glp_mem_usage(NULL, NULL, &b, NULL);
^
src/environment.c:92:18: error: use of undeclared identifier 'b'
return long2py(b);
^
src/environment.c:97:3: error: use of undeclared identifier 'glp_long'
GLP_LONG b;
^
src/environment.c:75:18: note: expanded from macro 'GLP_LONG'
#define GLP_LONG glp_long
^
src/environment.c:98:36: error: use of undeclared identifier 'b'
glp_mem_usage(NULL, NULL, NULL, &b);
^
src/environment.c:99:18: error: use of undeclared identifier 'b'
return long2py(b);
^
7 errors generated.
error: command '/usr/bin/clang' failed with exit status 1
make: *** [all] Error 1
And here is a part of the mentioned c file:
static PyObject* Environment_getblocks_peak(EnvironmentObject *self,
void *closure) {
int cpeak;
glp_mem_usage(NULL, &cpeak, NULL, NULL);
return PyInt_FromLong(cpeak);
}
#if GLPK_VERSION(4,28)
#define GLP_LONG glp_long
#else
#define GLP_LONG glp_ulong
#endif
static PyObject* long2py(GLP_LONG l) {
if ((l.hi==0 && l.lo>=0) || (l.hi==-1 && l.lo<0))
return PyInt_FromLong(l.lo);
PY_LONG_LONG ll = l.hi;
ll <<= 32;
ll |= (unsigned int)l.lo;
return PyLong_FromLongLong(ll);
}
static PyObject* Environment_getbytes(EnvironmentObject *self,void *closure) {
GLP_LONG b;
glp_mem_usage(NULL, NULL, &b, NULL);
return long2py(b);
}
Do I miss something to install? I use Python 2.7.5 |Anaconda 1.6.1 (x86_64)| and glpk @4.48_0 (active) with osx 10.8.4
Upvotes: 1
Views: 472
Reputation: 1
Several people have cloned the pyglpk code on github and updated it to work with the latest version of glpk. I have been using https://github.com/bradfordboyle/pyglpk and know that it works with glpk-4.61
Upvotes: 0
Reputation: 11
For me what I had to do is downgrade glpk all the way down to 4.39 as later versions you will encounter the glp_long issue.
Upvotes: 1