This is actually a solved problem, but I'm posting this here because I have to do this again and I want to be able to find the answer, and it may be a sign that there is a problem in the setup.py script. (once I figure out where to send it, I'll submit it as a bug report)
When I was installing Gurobi python using Canopy I get
=======
import gurobipy
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-1a30be95fe9a> in <module>()
----> 1 import gurobipy
/Canopy/Canopy_64bit/User/lib/python2.7/site-packages/gurobipy/__init__.py in <module>()
----> 1 from .gurobipy import *
ImportError: /Canopy/Canopy_64bit/User/lib/python2.7/site-packages/gurobipy/gurobipy.so: undefined symbol: PyUnicodeUCS4_Decode
=======
What I think is the underlying issue is that Canopy Python is 16bit unicode support (I think)
>>> sys.maxunicode
65535
But Gurobi's setup.py script thinks that it is 32 bit
I solved this by copying the following into my
userdir/Canopy/Canopy_64bit/User/lib/python2.7/site-packages/gurobipy folder
sudo cp /opt/gurobi563/linux64/lib/python2.7_utf16/gurobipy.so .
thus replacing the gurobipy.so file that was there. And now it works.
>>> execfile('/opt/gurobi563/linux64/examples/python/mip1.py')
Optimize a model with 2 rows, 3 columns and 5 nonzeros
Found heuristic solution: objective 2
Presolve removed 2 rows and 3 columns
Presolve time: 0.02s
Explored 0 nodes (0 simplex iterations) in 0.05 seconds
Thread count was 1 (of 4 available processors)
Optimal solution found (tolerance 1.00e-04)
Best objective 3.000000000000e+00, best bound 3.000000000000e+00, gap 0.0%
x 1
y 0
z 1
Obj: 3
>>> import gurobipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "userdir/anaconda/lib/python2.7/site-packages/gurobipy/__init__.py", line 1, in <module>
from .gurobipy import *
ImportError: userdir/anaconda/lib/python2.7/site-packages/gurobipy/gurobipy.so: undefined symbol: PyUnicodeUCS2_Decode
I solved this by copying the following into /anaconda/lib/python2.7/site-packages/gurobipy/
Ubuntu 14.04
Gurobi 5.6.3
Enthought Canopy Python 2.7.6 | 64-bit | (default, Jun 4 2014, 16:32:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Python 2.7.7 |Anaconda 2.0.1 (64-bit)| (default, Jun 2 2014, 12:34:02)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2