Anaconda Python for Gurobi 6.0.4 installation _Py_FalseStruct error

1.4k views Asked by At

In order to run an optimization problem we set up Gurobi 6.0.4 together with

  • Anaconda (Version 2.2.0) Python (Python 2.7.9.) on
  • Linux CentOS release 6.6 (Final) with the 2.6.32-504.16.2.el6.x86_64 Kernel

Following the installation guidelines of Gurobi (listed here: http://www.gurobi.com/documentation/6.0/quickstart_linux.pdf)

everything worked out in the first step. Gurobi was installed, could obtain a license. Also the PATH variables have been set (in the .bashrc) according to the manual, with a little extension for the referal to anaconda python (and not the other local Versions of python (being 2.7 and 3.4):

export GUROBI_HOME="/opt/gurobi604/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin:${PATH}:opt/anaconda/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"

Following the procedure we executed: python2.7 setup.py install in the respective directory /opt/gurobi604/linux64. After this usually you could run the import gurobipy command in the python interpreter wihtout errors. For older Versions of Gurobi (as 5.6.3) this works out very well.

For 6.0.4 though we constantly receive the error:

 ImportError: /opt/anaconda/lib/python2.7/site-packages/gurobipy/gurobipy.so: undefined symbol: _Py_FalseStruct

This is very reproducible, no matter if we put anaconda also in the global path, and check the bash for any overwriting of the environment variables, which is not the case.

On Windows 8 the Gurobi 6.0.4 and Anaconda Python 2.2.0 work together without any problems.

Also applying hints from here: Python Module Error on Linux did not work out.

Did anyone else experience these problems with this tooling combination? thx.

2

There are 2 answers

1
Kostja On

The error message indicates that you use the Python module for version 3.4 in your Python 2.7 package directory. This can happen if you do not clean your Python module build directory between builds. Please try the following:

  1. Completely remove the 2.7 package from your Python 2.7 installation (e.g. remove /opt/anaconda/lib/python2.7/site-packages/gurobipy)
  2. Completely remove the Python module build directory from your Gurobi installation (e.g. /opt/gurobi604/linux64/build)
  3. Re-run the build process for the Python 2.7 module (e.g. run "python2 setup.py install" in /opt/gurobi604/linux64)

Please note that CentOS is currently a non-supported platform for Gurobi.

0
Alexander Schuller On

Thank you for the hint, I think we tried that, but did not finish the procedure in this way. We tried to clean the system but in that particular case still hat both python Versions (due to other applications that use 3.4) on the machine. Our solution in this case was just to reinstall everything clean on a Ubuntu 14.04 VM. Since then no further problems occured. (I know not the cleanest solution.)

We had some similar issues when we updated to Gurobi 6.5, but that could be solved when corrctly addressing the usual path issues.

Thank you in any case for the reply, I think this really will help us with the next, then clean deployment :-)