Closed dcoudert closed 4 years ago
Thanks for testing!
I can now install the backend, but it's not enough
confetti:sage dcoudert$ ./sage -python -m pip install git+https://github.com/mkoeppe/sage-numerical-backends-gurobi
Collecting git+https://github.com/mkoeppe/sage-numerical-backends-gurobi
Cloning https://github.com/mkoeppe/sage-numerical-backends-gurobi to /private/var/folders/l8/sxf193t11mvdyqq56f4w_6_80000gn/T/pip-req-build-u600n7q_
Requirement already satisfied: sphinx in ./local/lib/python3.7/site-packages (from sage-numerical-backends-gurobi==9.0b12) (1.8.5)
Requirement already satisfied: six>=1.5 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (1.12.0)
Requirement already satisfied: Jinja2>=2.3 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (2.10)
Requirement already satisfied: Pygments>=2.0 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (2.3.1)
Requirement already satisfied: docutils>=0.11 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (0.14)
Requirement already satisfied: snowballstemmer>=1.1 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (1.2.1)
Requirement already satisfied: babel!=2.0,>=1.3 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (2.6.0)
Requirement already satisfied: alabaster<0.8,>=0.7 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (0.7.12)
Requirement already satisfied: imagesize in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (1.1.0)
Requirement already satisfied: requests>=2.0.0 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (2.13.0)
Requirement already satisfied: setuptools in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (40.6.3)
Requirement already satisfied: packaging in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (18.0)
Requirement already satisfied: sphinxcontrib-websupport in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (1.1.0)
Requirement already satisfied: MarkupSafe>=0.23 in ./local/lib/python3.7/site-packages (from Jinja2>=2.3->sphinx->sage-numerical-backends-gurobi==9.0b12) (1.1.0)
Requirement already satisfied: pytz>=0a in ./local/lib/python3.7/site-packages (from babel!=2.0,>=1.3->sphinx->sage-numerical-backends-gurobi==9.0b12) (2018.7)
Requirement already satisfied: pyparsing>=2.0.2 in ./local/lib/python3.7/site-packages (from packaging->sphinx->sage-numerical-backends-gurobi==9.0b12) (2.3.0)
Installing collected packages: sage-numerical-backends-gurobi
Running setup.py install for sage-numerical-backends-gurobi ... done
Successfully installed sage-numerical-backends-gurobi-9.0b12
confetti:sage dcoudert$ ./sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.1.beta0, Release Date: 2020-01-10 │
│ Using Python 3.7.3. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable. ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: G = graphs.PetersenGraph()
sage: G.maximum_average_degree(verbose=1,solver='gurobi')
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-c7c52fcad74b> in <module>()
----> 1 G.maximum_average_degree(verbose=Integer(1),solver='gurobi')
/Users/dcoudert/sage/local/lib/python3.7/site-packages/sage/graphs/graph.py in maximum_average_degree(self, value_only, solver, verbose)
4780 from sage.numerical.mip import MixedIntegerLinearProgram
4781
-> 4782 p = MixedIntegerLinearProgram(maximization=True, solver=solver)
4783
4784 d = p.new_variable(nonnegative=True)
/Users/dcoudert/sage/local/lib/python3.7/site-packages/sage/numerical/mip.pyx in sage.numerical.mip.MixedIntegerLinearProgram.__init__ (build/cythonized/sage/numerical/mip.c:3937)()
439 self._first_variable_names = list(names)
440 from sage.numerical.backends.generic_backend import get_solver
--> 441 self._backend = get_solver(solver=solver,
442 constraint_generation=constraint_generation,
443 base_ring=base_ring)
/Users/dcoudert/sage/local/lib/python3.7/site-packages/sage/numerical/backends/generic_backend.pyx in sage.numerical.backends.generic_backend.get_solver (build/cythonized/sage/numerical/backends/generic_backend.c:20105)()
1635 raise ValueError("'solver' should be set to 'GLPK', 'Coin', 'CPLEX', 'CVXOPT', 'Gurobi', 'PPL', 'InteractiveLP', a callable, or None.")
1636
-> 1637 cpdef GenericBackend get_solver(constraint_generation = False, solver = None, base_ring = None):
1638 """
1639 Return a solver according to the given preferences
/Users/dcoudert/sage/local/lib/python3.7/site-packages/sage/numerical/backends/generic_backend.pyx in sage.numerical.backends.generic_backend.get_solver (build/cythonized/sage/numerical/backends/generic_backend.c:19796)()
1778
1779 elif solver == "Gurobi":
-> 1780 from sage_numerical_backends_gurobi.gurobi_backend import GurobiBackend
1781 return GurobiBackend()
1782
ImportError: dlopen(/Users/dcoudert/sage/local/lib/python3.7/site-packages/sage_numerical_backends_gurobi/gurobi_backend.cpython-37m-darwin.so, 2): Library not loaded: libgurobi81_light.dylib
Referenced from: /Users/dcoudert/sage/local/lib/python3.7/site-packages/sage_numerical_backends_gurobi/gurobi_backend.cpython-37m-darwin.so
Reason: image not found
I can now install the backend, but it's not enough
ImportError: dlopen(/Users/dcoudert/sage/local/lib/python3.7/site-packages/sage_numerical_backends_gurobi/gurobi_backend.cpython-37m-darwin.so, 2): Library not loaded: libgurobi81_light.dylib Referenced from: /Users/dcoudert/sage/local/lib/python3.7/site-packages/sage_numerical_backends_gurobi/gurobi_backend.cpython-37m-darwin.so Reason: image not found
Could you post the output of otool -l -L /Users/dcoudert/sage/local/lib/python3.7/site-packages/sage_numerical_backends_gurobi/gurobi_backend.cpython-37m-darwin.so
?
confetti:sage dcoudert$ otool -l -L /Users/dcoudert/sage/local/lib/python3.7/site-packages/sage_numerical_backends_gurobi/gurobi_backend.cpython-37m-darwin.so
/Users/dcoudert/sage/local/lib/python3.7/site-packages/sage_numerical_backends_gurobi/gurobi_backend.cpython-37m-darwin.so:
libgurobi81_light.dylib (compatibility version 8.1.0, current version 8.1.1)
/Users/dcoudert/sage/local/lib/libpari-gmp.dylib (compatibility version 2.11.0, current version 2.11.2)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
0xfeedfacf 16777223 3 0x00 8 18 1872 0x00000085
Load command 0
cmd LC_SEGMENT_64
cmdsize 552
segname __TEXT
vmaddr 0x0000000000000000
vmsize 0x000000000001f000
fileoff 0
filesize 126976
maxprot 0x00000005
initprot 0x00000005
nsects 6
flags 0x0
Section
sectname __text
segname __TEXT
addr 0x0000000000000c00
size 0x000000000001b289
offset 3072
align 2^4 (16)
reloff 0
nreloc 0
flags 0x80000400
reserved1 0
reserved2 0
Section
sectname __stubs
segname __TEXT
addr 0x000000000001be8a
size 0x0000000000000348
offset 114314
align 2^1 (2)
reloff 0
nreloc 0
flags 0x80000408
reserved1 0 (index into indirect symbol table)
reserved2 6 (size of stubs)
Section
sectname __stub_helper
segname __TEXT
addr 0x000000000001c1d4
size 0x0000000000000588
offset 115156
align 2^2 (4)
reloff 0
nreloc 0
flags 0x80000400
reserved1 0
reserved2 0
Section
sectname __const
segname __TEXT
addr 0x000000000001c760
size 0x0000000000001058
offset 116576
align 2^4 (16)
reloff 0
nreloc 0
flags 0x00000000
reserved1 0
reserved2 0
Section
sectname __cstring
segname __TEXT
addr 0x000000000001d7b8
size 0x0000000000001731
offset 120760
align 2^0 (1)
reloff 0
nreloc 0
flags 0x00000002
reserved1 0
reserved2 0
Section
sectname __unwind_info
segname __TEXT
addr 0x000000000001eeec
size 0x0000000000000114
offset 126700
align 2^2 (4)
reloff 0
nreloc 0
flags 0x00000000
reserved1 0
reserved2 0
Load command 1
cmd LC_SEGMENT_64
cmdsize 632
segname __DATA
vmaddr 0x000000000001f000
vmsize 0x0000000000009000
fileoff 126976
filesize 36864
maxprot 0x00000003
initprot 0x00000003
nsects 7
flags 0x0
Section
sectname __nl_symbol_ptr
segname __DATA
addr 0x000000000001f000
size 0x0000000000000008
offset 126976
align 2^3 (8)
reloff 0
nreloc 0
flags 0x00000006
reserved1 140 (index into indirect symbol table)
reserved2 0
Section
sectname __got
segname __DATA
addr 0x000000000001f008
size 0x0000000000000108
offset 126984
align 2^3 (8)
reloff 0
nreloc 0
flags 0x00000006
reserved1 141 (index into indirect symbol table)
reserved2 0
Section
sectname __la_symbol_ptr
segname __DATA
addr 0x000000000001f110
size 0x0000000000000460
offset 127248
align 2^3 (8)
reloff 0
nreloc 0
flags 0x00000007
reserved1 174 (index into indirect symbol table)
reserved2 0
Section
sectname __const
segname __DATA
addr 0x000000000001f570
size 0x0000000000002210
offset 128368
align 2^4 (16)
reloff 0
nreloc 0
flags 0x00000000
reserved1 0
reserved2 0
Section
sectname __data
segname __DATA
addr 0x0000000000021780
size 0x0000000000005ac0
offset 137088
align 2^4 (16)
reloff 0
nreloc 0
flags 0x00000000
reserved1 0
reserved2 0
Section
sectname __common
segname __DATA
addr 0x0000000000027240
size 0x0000000000000040
offset 0
align 2^3 (8)
reloff 0
nreloc 0
flags 0x00000001
reserved1 0
reserved2 0
Section
sectname __bss
segname __DATA
addr 0x0000000000027280
size 0x0000000000000ab8
offset 0
align 2^4 (16)
reloff 0
nreloc 0
flags 0x00000001
reserved1 0
reserved2 0
Load command 2
cmd LC_SEGMENT_64
cmdsize 72
segname __LINKEDIT
vmaddr 0x0000000000028000
vmsize 0x0000000000019000
fileoff 163840
filesize 99776
maxprot 0x00000001
initprot 0x00000001
nsects 0
flags 0x0
Load command 3
cmd LC_DYLD_INFO_ONLY
cmdsize 48
rebase_off 163840
rebase_size 560
bind_off 164400
bind_size 672
weak_bind_off 0
weak_bind_size 0
lazy_bind_off 165072
lazy_bind_size 3480
export_off 168552
export_size 328
Load command 4
cmd LC_SYMTAB
cmdsize 24
symoff 169080
nsyms 1816
stroff 199392
strsize 64224
Load command 5
cmd LC_DYSYMTAB
cmdsize 80
ilocalsym 0
nlocalsym 1638
iextdefsym 1638
nextdefsym 5
iundefsym 1643
nundefsym 173
tocoff 0
ntoc 0
modtaboff 0
nmodtab 0
extrefsymoff 0
nextrefsyms 0
indirectsymoff 198136
nindirectsyms 314
extreloff 0
nextrel 0
locreloff 0
nlocrel 0
Load command 6
cmd LC_UUID
cmdsize 24
uuid 94978A5D-5204-34FE-9479-75F25D26B1BF
Load command 7
cmd LC_VERSION_MIN_MACOSX
cmdsize 16
version 10.9
sdk 10.14
Load command 8
cmd LC_SOURCE_VERSION
cmdsize 16
version 0.0
Load command 9
cmd LC_LOAD_DYLIB
cmdsize 48
name libgurobi81_light.dylib (offset 24)
time stamp 2 Thu Jan 1 01:00:02 1970
current version 8.1.1
compatibility version 8.1.0
Load command 10
cmd LC_LOAD_DYLIB
cmdsize 80
name /Users/dcoudert/sage/local/lib/libpari-gmp.dylib (offset 24)
time stamp 2 Thu Jan 1 01:00:02 1970
current version 2.11.2
compatibility version 2.11.0
Load command 11
cmd LC_LOAD_DYLIB
cmdsize 56
name /usr/lib/libSystem.B.dylib (offset 24)
time stamp 2 Thu Jan 1 01:00:02 1970
current version 1252.250.1
compatibility version 1.0.0
Load command 12
cmd LC_RPATH
cmdsize 48
path /Users/dcoudert/sage/local/lib (offset 12)
Load command 13
cmd LC_RPATH
cmdsize 48
path /Users/dcoudert/sage/local/lib (offset 12)
Load command 14
cmd LC_RPATH
cmdsize 48
path /Users/dcoudert/sage/local/lib (offset 12)
Load command 15
cmd LC_RPATH
cmdsize 48
path /Library/gurobi811/mac64/lib (offset 12)
Load command 16
cmd LC_FUNCTION_STARTS
cmdsize 16
dataoff 168880
datasize 176
Load command 17
cmd LC_DATA_IN_CODE
cmdsize 16
dataoff 169056
datasize 24
Looks like an install_name
problem specific to 8.1.1. I'll try to find a fix.
Gurobi 8.1.1 now works for me, using a84ad119686c4f021830ee3b762058e2553a7071 (in current master)
I tried to install again but I suspect I should either uninstall something or force installing something. What's the correct way to do that ?
confetti:sage dcoudert$ ./sage -python -m pip install git+https://github.com/mkoeppe/sage-numerical-backends-gurobi
Collecting git+https://github.com/mkoeppe/sage-numerical-backends-gurobi
Cloning https://github.com/mkoeppe/sage-numerical-backends-gurobi to /private/var/folders/l8/sxf193t11mvdyqq56f4w_6_80000gn/T/pip-req-build-gz4bjl7_
Requirement already satisfied (use --upgrade to upgrade): sage-numerical-backends-gurobi==9.0b12 from git+https://github.com/mkoeppe/sage-numerical-backends-gurobi in ./local/lib/python3.7/site-packages
Requirement already satisfied: sphinx in ./local/lib/python3.7/site-packages (from sage-numerical-backends-gurobi==9.0b12) (1.8.5)
Requirement already satisfied: six>=1.5 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (1.12.0)
Requirement already satisfied: Jinja2>=2.3 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (2.10)
Requirement already satisfied: Pygments>=2.0 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (2.3.1)
Requirement already satisfied: docutils>=0.11 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (0.14)
Requirement already satisfied: snowballstemmer>=1.1 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (1.2.1)
Requirement already satisfied: babel!=2.0,>=1.3 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (2.6.0)
Requirement already satisfied: alabaster<0.8,>=0.7 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (0.7.12)
Requirement already satisfied: imagesize in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (1.1.0)
Requirement already satisfied: requests>=2.0.0 in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (2.13.0)
Requirement already satisfied: setuptools in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (40.6.3)
Requirement already satisfied: packaging in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (18.0)
Requirement already satisfied: sphinxcontrib-websupport in ./local/lib/python3.7/site-packages (from sphinx->sage-numerical-backends-gurobi==9.0b12) (1.1.0)
Requirement already satisfied: MarkupSafe>=0.23 in ./local/lib/python3.7/site-packages (from Jinja2>=2.3->sphinx->sage-numerical-backends-gurobi==9.0b12) (1.1.0)
Requirement already satisfied: pytz>=0a in ./local/lib/python3.7/site-packages (from babel!=2.0,>=1.3->sphinx->sage-numerical-backends-gurobi==9.0b12) (2018.7)
Requirement already satisfied: pyparsing>=2.0.2 in ./local/lib/python3.7/site-packages (from packaging->sphinx->sage-numerical-backends-gurobi==9.0b12) (2.3.0)
Try ./sage -python -m pip install --force-reinstall git+https://github.com/mkoeppe/sage-numerical-backends-gurobi
Working ! Thank you.
Great, thanks for testing!
I have an error when trying to install the gurobi backend that is now a separate optional package. I followed the instructions for installing the gurobi backend with sage 9.1.beta0 and macOS Mojave 10.14.6. I have gurobi 8.11 and gurobi.sh is in my path (so no need to set GUROBI_HOME). (note that I successfully installed the cplex backend).