I'm trying to install COBRApy in a cluster (Stampede) to do a large scale sweep of parameters, but I'm getting stuck on the installation.
The cluster already has GMP and GLPK installed, but in non standard locations (/opt/apps/gcc4_7/glpk/4.45/).
I installed VirtualEnv so I could have my own python environment where I could install everything, and I did install PyGLPK from COBRA sourceforge package. It built with no errors, tested fine and installed also with no errors. The result is that I am able to load the module glpk (import glpk).
However, when I try to install cobra, I get several errors due to the setup process not finding glpk.h (the full output is below).
The header file is there, in the non-standard location. I checked: /opt/apps/gcc4_7/glpk/4.45/include/glpk.h
Cobra finishes the instalation but apparently with no support for glpk.
Curiously, if I import glpk before importing cobra, then cobra finds it and is able to use it for optimization of models, even though the installation gives errors.
Is there anything I can do to direct the instalation process to look for the header file in the right place?
On a side note, if I run "pip install cobra", without the "--pre" at the end, it installs version 0.2.1 with no errors and is able to load glpk on its own.
Thank you for your attention.
################## Full output of instalation.
(PyEnv)[user@login2 Programas]$ pip install cobra --pre
Downloading/unpacking cobra
Downloading cobra-0.3.0b2.tar.gz (2.2MB): 2.2MB downloaded
Running setup.py (path:/home1/02603/user/Programas/PyEnv/build/cobra/setup.py) egg_info for package cobra
('missing cimport', 'cobra/solvers/cglpk.pyx')
libc.stdlib
glpk
/opt/apps/python/epd/7.3.2/lib/python2.7/site-packages/Cython/Includes/libc/stdlib.pxd
Installing collected packages: cobra
Running setup.py install for cobra
('missing cimport', 'cobra/solvers/cglpk.pyx')
libc.stdlib
glpk
/opt/apps/python/epd/7.3.2/lib/python2.7/site-packages/Cython/Includes/libc/stdlib.pxd
building 'cobra.solvers.cglpk' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -O2 -fPIC -I/opt/apps/python/epd/7.3.2/include/python2.7 -c cobra/solvers/cglpk.c -o build/temp.linux-x86_64-2.7/cobra/solvers/cglpk.o
cobra/solvers/cglpk.c:343:18: error: glpk.h: No such file or directory
cobra/solvers/cglpk.c:547: error: expected specifier-qualifier-list before ‘glp_prob’
cobra/solvers/cglpk.c:859: error: expected ‘)’ before ‘s’
cobra/solvers/cglpk.c: In function ‘__pyx_pf_5cobra_7solvers_5cglpk_3GLP___cinit__’:
cobra/solvers/cglpk.c:1205: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:1214: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:1214: error: ‘GLP_MAX’ undeclared (first use in this function)
cobra/solvers/cglpk.c:1214: error: (Each undeclared identifier is reported only once
cobra/solvers/cglpk.c:1214: error: for each function it appears in.)
cobra/solvers/cglpk.c:1223: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘parameters’
cobra/solvers/cglpk.c:1232: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘integer_parameters’
cobra/solvers/cglpk.c: In function ‘__pyx_pf_5cobra_7solvers_5cglpk_3GLP_2__dealloc__’:
cobra/solvers/cglpk.c:1278: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c: In function ‘__pyx_pf_5cobra_7solvers_5cglpk_3GLP_4__init__’:
cobra/solvers/cglpk.c:1364: error: ‘glp_prob’ undeclared (first use in this function)
cobra/solvers/cglpk.c:1364: error: ‘__pyx_v_glp’ undeclared (first use in this function)
cobra/solvers/cglpk.c:1382: error: ‘__pyx_t_3’ undeclared (first use in this function)
cobra/solvers/cglpk.c:1411: error: ‘GLP_OFF’ undeclared (first use in this function)
cobra/solvers/cglpk.c:1420: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘parameters’
cobra/solvers/cglpk.c:1420: error: ‘GLP_MSG_ERR’ undeclared (first use in this function)
cobra/solvers/cglpk.c:1451: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:1701: error: ‘GLP_FX’ undeclared (first use in this function)
cobra/solvers/cglpk.c:1722: error: ‘GLP_UP’ undeclared (first use in this function)
cobra/solvers/cglpk.c:1743: error: ‘GLP_LO’ undeclared (first use in this function)
cobra/solvers/cglpk.c:1879: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:1879: error: ‘GLP_BV’ undeclared (first use in this function)
cobra/solvers/cglpk.c:1891: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:1891: error: ‘GLP_IV’ undeclared (first use in this function)
cobra/solvers/cglpk.c:1935: error: ‘GLP_DB’ undeclared (first use in this function)
cobra/solvers/cglpk.c: In function ‘__pyx_f_5cobra_7solvers_5cglpk_3GLP_change_variable_bounds’:
cobra/solvers/cglpk.c:2468: error: ‘GLP_DB’ undeclared (first use in this function)
cobra/solvers/cglpk.c:2503: error: ‘GLP_FX’ undeclared (first use in this function)
cobra/solvers/cglpk.c:2515: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c: In function ‘__pyx_pf_5cobra_7solvers_5cglpk_3GLP_10change_coefficient’:
cobra/solvers/cglpk.c:2760: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:2813: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:2852: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:2892: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c: In function ‘__pyx_pf_5cobra_7solvers_5cglpk_3GLP_12solve_problem’:
cobra/solvers/cglpk.c:2964: error: ‘glp_smcp’ undeclared (first use in this function)
cobra/solvers/cglpk.c:2964: error: expected ‘;’ before ‘__pyx_v_parameters’
cobra/solvers/cglpk.c:2965: error: ‘glp_iocp’ undeclared (first use in this function)
cobra/solvers/cglpk.c:2965: error: expected ‘;’ before ‘__pyx_v_integer_parameters’
cobra/solvers/cglpk.c:2966: error: ‘glp_prob’ undeclared (first use in this function)
cobra/solvers/cglpk.c:2966: error: ‘__pyx_v_glp’ undeclared (first use in this function)
cobra/solvers/cglpk.c:2971: error: expected ‘;’ before ‘__pyx_t_1’
cobra/solvers/cglpk.c:2972: error: expected ‘;’ before ‘__pyx_t_2’
cobra/solvers/cglpk.c:2973: error: ‘__pyx_t_3’ undeclared (first use in this function)
cobra/solvers/cglpk.c:2996: error: ‘__pyx_t_1’ undeclared (first use in this function)
cobra/solvers/cglpk.c:2996: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘parameters’
cobra/solvers/cglpk.c:2997: error: ‘__pyx_v_parameters’ undeclared (first use in this function)
cobra/solvers/cglpk.c:3006: error: ‘__pyx_t_2’ undeclared (first use in this function)
cobra/solvers/cglpk.c:3006: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘integer_parameters’
cobra/solvers/cglpk.c:3007: error: ‘__pyx_v_integer_parameters’ undeclared (first use in this function)
cobra/solvers/cglpk.c:3016: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:3177: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘parameters’
cobra/solvers/cglpk.c:3178: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘integer_parameters’
cobra/solvers/cglpk.c:3187: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘parameters’
cobra/solvers/cglpk.c:3188: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘integer_parameters’
cobra/solvers/cglpk.c:3197: error: ‘GLP_OFF’ undeclared (first use in this function)
cobra/solvers/cglpk.c:3215: error: ‘GLP_ON’ undeclared (first use in this function)
cobra/solvers/cglpk.c: In function ‘__pyx_pf_5cobra_7solvers_5cglpk_3GLP_16get_status’:
cobra/solvers/cglpk.c:3497: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:3499: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:3510: error: ‘GLP_OPT’ undeclared (first use in this function)
cobra/solvers/cglpk.c:3533: error: ‘GLP_FEAS’ undeclared (first use in this function)
cobra/solvers/cglpk.c:3544: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:3558: error: ‘GLP_UNDEF’ undeclared (first use in this function)
cobra/solvers/cglpk.c:3581: error: ‘GLP_UNBND’ undeclared (first use in this function)
cobra/solvers/cglpk.c:3604: error: ‘GLP_NOFEAS’ undeclared (first use in this function)
cobra/solvers/cglpk.c: In function ‘__pyx_f_5cobra_7solvers_5cglpk_3GLP_set_objective_sense’:
cobra/solvers/cglpk.c:3728: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:3728: error: ‘GLP_MAX’ undeclared (first use in this function)
cobra/solvers/cglpk.c:3749: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:3749: error: ‘GLP_MIN’ undeclared (first use in this function)
cobra/solvers/cglpk.c: In function ‘__pyx_f_5cobra_7solvers_5cglpk_3GLP_set_parameter’:
cobra/solvers/cglpk.c:3939: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘parameters’
cobra/solvers/cglpk.c:3961: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘parameters’
cobra/solvers/cglpk.c:3971: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘parameters’
cobra/solvers/cglpk.c:3993: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘parameters’
cobra/solvers/cglpk.c:4015: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘integer_parameters’
cobra/solvers/cglpk.c:4039: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘integer_parameters’
cobra/solvers/cglpk.c:4075: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘parameters’
cobra/solvers/cglpk.c:4075: error: ‘GLP_MSG_ERR’ undeclared (first use in this function)
cobra/solvers/cglpk.c:4097: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘parameters’
cobra/solvers/cglpk.c:4097: error: ‘GLP_MSG_OFF’ undeclared (first use in this function)
cobra/solvers/cglpk.c:4124: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘parameters’
cobra/solvers/cglpk.c:4124: error: ‘GLP_MSG_ALL’ undeclared (first use in this function)
cobra/solvers/cglpk.c:4145: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘parameters’
cobra/solvers/cglpk.c:4145: error: ‘GLP_MSG_ON’ undeclared (first use in this function)
cobra/solvers/cglpk.c: In function ‘__pyx_f_5cobra_7solvers_5cglpk_3GLP_get_objective_value’:
cobra/solvers/cglpk.c:4322: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:4337: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c: In function ‘__pyx_f_5cobra_7solvers_5cglpk_3GLP_change_variable_objective’:
cobra/solvers/cglpk.c:4477: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c: In function ‘__pyx_f_5cobra_7solvers_5cglpk_3GLP_is_mip’:
cobra/solvers/cglpk.c:4635: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c: In function ‘__pyx_pf_5cobra_7solvers_5cglpk_3GLP_28format_solution’:
cobra/solvers/cglpk.c:4727: error: ‘glp_prob’ undeclared (first use in this function)
cobra/solvers/cglpk.c:4727: error: ‘__pyx_v_glp’ undeclared (first use in this function)
cobra/solvers/cglpk.c:4735: error: ‘__pyx_t_1’ undeclared (first use in this function)
cobra/solvers/cglpk.c:4758: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c: In function ‘__pyx_pf_5cobra_7solvers_5cglpk_3GLP_30__getstate__’:
cobra/solvers/cglpk.c:5382: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c: In function ‘__pyx_pf_5cobra_7solvers_5cglpk_3GLP_34__setstate__’:
cobra/solvers/cglpk.c:5886: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c: In function ‘__pyx_pf_5cobra_7solvers_5cglpk_3GLP_36__copy__’:
cobra/solvers/cglpk.c:6002: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:6002: error: ‘struct __pyx_obj_5cobra_7solvers_5cglpk_GLP’ has no member named ‘glp’
cobra/solvers/cglpk.c:6002: error: ‘GLP_ON’ undeclared (first use in this function)
cobra/solvers/cglpk.c: In function ‘initcglpk’:
cobra/solvers/cglpk.c:7828: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast
/opt/apps/python/epd/7.3.2/include/python2.7/stringobject.h:63: note: expected ‘const char *’ but argument is of type ‘int’
cobra/solvers/cglpk.c: At top level:
cobra/solvers/cglpk.c:9241: error: expected ‘)’ before ‘s’
Successfully installed cobra
Cleaning up...