convexengineering / gpkit

Geometric programming for engineers
http://gpkit.readthedocs.org
MIT License
206 stars 40 forks source link

Mosek install error #1500

Closed mjburton11 closed 4 years ago

mjburton11 commented 4 years ago

Running with Anaconda2, Python 3.7, Mosek 8 (although I also saw this issue when running with Mosek 9) on someone else's machine. Got this error:

Traceback (most recent call last):
  File "C:/Users/burton.michael/Pegasus_MVP/pegasus_gp/cases.py", line 306, in <module>
    sol = mis.solve('mosek')
  File "C:\Users\burton.michael\AppData\Roaming\Python\Python37\site-packages\gpkit\constraints\prog_factories.py", line 124, in solvefn
    result = progsolve(solver, verbosity, **kwargs)
  File "C:\Users\burton.michael\AppData\Roaming\Python\Python37\site-packages\gpkit\constraints\gp.py", line 152, in solve
    solverfn, solvername = _get_solver(solver, kwargs)
  File "C:\Users\burton.michael\AppData\Roaming\Python\Python37\site-packages\gpkit\constraints\gp.py", line 40, in _get_solver
    from .._mosek import expopt
  File "C:\Users\burton.michael\AppData\Roaming\Python\Python37\site-packages\gpkit\_mosek\expopt.py", line 17, in <module>
    from .baked_ctypesgen import load_library, String, c_void, POINTER, UNCHECKED
  File "C:\Users\burton.michael\AppData\Roaming\Python\Python37\site-packages\gpkit\_mosek\baked_ctypesgen.py", line 376
    except OSError,e:
                  ^
SyntaxError: invalid syntax

When I run python python -c "from gpkit.build import build; build()" it looks good so I'm surprised that this is not working

I get this result

# Moving to the directory from which GPkit was imported.
Started building gpkit...

Attempting to find and build solvers:

# Looking for mosek
#     Found C:\Program Files\Mosek\8\tools\platform\win64x86\h\mosek.h
#     Found C:\Program Files\Mosek\8\tools\platform\win64x86\bin\mosek64_8_1.dll
#     Found C:\Program Files\Mosek\8\tools\examples\c\scopt-ext.c
#     Found C:\Program Files\Mosek\8\tools\examples\c\expopt.c
#     Found C:\Program Files\Mosek\8\tools\examples\c\dgopt.c
#     Found C:\Program Files\Mosek\8\tools\examples\c\scopt-ext.h
#     Found C:\Program Files\Mosek\8\tools\examples\c\expopt.h
#     Found C:\Program Files\Mosek\8\tools\examples\c\dgopt.h
#     Found C:\Program Files\Mosek\8\tools\platform\win64x86\h\mosek.h
# Found mosek version 8, installed to C:\Program Files\Mosek
#
# Building mosek...
#     Replacing directory _mosek\build
#
#   Copying expopt library files to _mosek\build
#     Copying C:\Program Files\Mosek\8\tools\examples\c\scopt-ext.c
#     Copying C:\Program Files\Mosek\8\tools\examples\c\expopt.c
#     Copying C:\Program Files\Mosek\8\tools\examples\c\dgopt.c
#     Copying C:\Program Files\Mosek\8\tools\examples\c\scopt-ext.h
#     Copying C:\Program Files\Mosek\8\tools\examples\c\expopt.h
#     Copying C:\Program Files\Mosek\8\tools\examples\c\dgopt.h
#     Copying C:\Program Files\Mosek\8\tools\platform\win64x86\h\mosek.h
#
#   Applying expopt patches...
#
#     Change in _mosek\build\dgopt.con line 651
#     --         printf("Number of Hessian non-zeros: %d\n",nlh[0]->numhesnz);
#     ++ MSK_echotask(task,MSK_STREAM_MSG,"Number of Hessian non-zeros: %d\n",n
#
#     Change in _mosek\build\expopt.con line 566
#     --         printf("Warning: The variable with index '%d' has only positiv
#     ++ MSK_echotask(expopttask,MSK_STREAM_MSG, "Warning: The variable with in
#
#     Change in _mosek\build\expopt.con line 579
#     --         printf("Warning: The variable with index '%d' has only negativ
#     ++ MSK_echotask(expopttask,MSK_STREAM_MSG, "Warning: The variable with in
#
#     Change in _mosek\build\expopt.con line 1115
#     --     printf ("solsta = %d, prosta = %d\n", (int)*solsta,(int)*prosta);
#     ++ MSK_echotask(expopttask,MSK_STREAM_MSG, "solsta = %d, prosta = %d\n",
#
#   Building expopt library...
#     Calling 'gcc -fpic -shared -Wl,--export-all-symbols,-R "C:\Program Files\Mosek\8\tools\platform\win64x86\bin"    _mosek\build\scopt-ext.c _mosek\build\expopt.c _mosek\build\dgopt.c   "C:\Program Files\Mosek\8\tools\platform\win64x86\bin\mosek64_8_1.dll" -o C:\Users\burton.michael\AppData\Roaming\Python\Python37\site-packages\gpkit\_mosek\build\expopt.so'
##
### CALL BEGINS
### CALL ENDS
##
# Done building mosek
# Looking for mosek_cli
#   Trying to run mskexpopt...
#     Calling 'mskexpopt'
##
### CALL BEGINS
No filename given.
Usage:
     mskexpopt FILENAME [-primal] [-dual] [-p parameterfile]
Return code: 1052
Description: MSK_RES_ERR_FILE_OPEN [An error occurred while opening a file.]
### CALL ENDS
##
# Found mosek_cli in system path
# Looking for mosek_conif
#   Trying to import mosek...
# Found mosek_conif in Python path
# Looking for cvxopt
#   Trying to import cvxopt...
# Found cvxopt in Python path
...finished building gpkit.

Found the following solvers: mosek, mosek_cli, mosek_conif, cvxopt
#     Replacing directory env
bqpd commented 4 years ago

python 3 doesn't support mosek, unfortunately. i should add a version print to that build message, but this should build fine on a newer version.

the reason it works with the second command is that it's building but not running the tests

On Mon, Jul 6, 2020, 14:01 Michael Burton notifications@github.com wrote:

Running with Anaconda2, Python 3.7, Mosek 8 (although I also saw this issue when running with Mosek 9) on someone else's machine. Got this error:

Traceback (most recent call last): File "C:/Users/burton.michael/Pegasus_MVP/pegasus_gp/cases.py", line 306, in sol = mis.solve('mosek') File "C:\Users\burton.michael\AppData\Roaming\Python\Python37\site-packages\gpkit\constraints\prog_factories.py", line 124, in solvefn result = progsolve(solver, verbosity, **kwargs) File "C:\Users\burton.michael\AppData\Roaming\Python\Python37\site-packages\gpkit\constraints\gp.py", line 152, in solve solverfn, solvername = _get_solver(solver, kwargs) File "C:\Users\burton.michael\AppData\Roaming\Python\Python37\site-packages\gpkit\constraints\gp.py", line 40, in _get_solver from .._mosek import expopt File "C:\Users\burton.michael\AppData\Roaming\Python\Python37\site-packages\gpkit_mosek\expopt.py", line 17, in from .baked_ctypesgen import load_library, String, c_void, POINTER, UNCHECKED File "C:\Users\burton.michael\AppData\Roaming\Python\Python37\site-packages\gpkit_mosek\baked_ctypesgen.py", line 376 except OSError,e: ^SyntaxError: invalid syntax

When I run python python -c "from gpkit.build import build; build()" it looks good so I'm surprised that this is not working

I get this result

Moving to the directory from which GPkit was imported.

Started building gpkit...

Attempting to find and build solvers:

Looking for mosek

Found C:\Program Files\Mosek\8\tools\platform\win64x86\h\mosek.h

Found C:\Program Files\Mosek\8\tools\platform\win64x86\bin\mosek64_8_1.dll

Found C:\Program Files\Mosek\8\tools\examples\c\scopt-ext.c

Found C:\Program Files\Mosek\8\tools\examples\c\expopt.c

Found C:\Program Files\Mosek\8\tools\examples\c\dgopt.c

Found C:\Program Files\Mosek\8\tools\examples\c\scopt-ext.h

Found C:\Program Files\Mosek\8\tools\examples\c\expopt.h

Found C:\Program Files\Mosek\8\tools\examples\c\dgopt.h

Found C:\Program Files\Mosek\8\tools\platform\win64x86\h\mosek.h

Found mosek version 8, installed to C:\Program Files\Mosek

#

Building mosek...

Replacing directory _mosek\build

#

Copying expopt library files to _mosek\build

Copying C:\Program Files\Mosek\8\tools\examples\c\scopt-ext.c

Copying C:\Program Files\Mosek\8\tools\examples\c\expopt.c

Copying C:\Program Files\Mosek\8\tools\examples\c\dgopt.c

Copying C:\Program Files\Mosek\8\tools\examples\c\scopt-ext.h

Copying C:\Program Files\Mosek\8\tools\examples\c\expopt.h

Copying C:\Program Files\Mosek\8\tools\examples\c\dgopt.h

Copying C:\Program Files\Mosek\8\tools\platform\win64x86\h\mosek.h

#

Applying expopt patches...

#

Change in _mosek\build\dgopt.con line 651

-- printf("Number of Hessian non-zeros: %d\n",nlh[0]->numhesnz);

++ MSK_echotask(task,MSK_STREAM_MSG,"Number of Hessian non-zeros: %d\n",n

#

Change in _mosek\build\expopt.con line 566

-- printf("Warning: The variable with index '%d' has only positiv

++ MSK_echotask(expopttask,MSK_STREAM_MSG, "Warning: The variable with in

#

Change in _mosek\build\expopt.con line 579

-- printf("Warning: The variable with index '%d' has only negativ

++ MSK_echotask(expopttask,MSK_STREAM_MSG, "Warning: The variable with in

#

Change in _mosek\build\expopt.con line 1115

-- printf ("solsta = %d, prosta = %d\n", (int)solsta,(int)prosta);

++ MSK_echotask(expopttask,MSK_STREAM_MSG, "solsta = %d, prosta = %d\n",

#

Building expopt library...

Calling 'gcc -fpic -shared -Wl,--export-all-symbols,-R "C:\Program Files\Mosek\8\tools\platform\win64x86\bin" _mosek\build\scopt-ext.c _mosek\build\expopt.c _mosek\build\dgopt.c "C:\Program Files\Mosek\8\tools\platform\win64x86\bin\mosek64_8_1.dll" -o C:\Users\burton.michael\AppData\Roaming\Python\Python37\site-packages\gpkit_mosek\build\expopt.so'

CALL BEGINS

CALL ENDS

Done building mosek

Looking for mosek_cli

Trying to run mskexpopt...

Calling 'mskexpopt'

CALL BEGINS

No filename given. Usage: mskexpopt FILENAME [-primal] [-dual] [-p parameterfile] Return code: 1052 Description: MSK_RES_ERR_FILE_OPEN [An error occurred while opening a file.]

CALL ENDS

Found mosek_cli in system path

Looking for mosek_conif

Trying to import mosek...

Found mosek_conif in Python path

Looking for cvxopt

Trying to import cvxopt...

Found cvxopt in Python path

...finished building gpkit.

Found the following solvers: mosek, mosek_cli, mosek_conif, cvxopt

Replacing directory env

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/convexengineering/gpkit/issues/1500, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALKAGGHJYA2B3OBY2PISJDR2JCPJANCNFSM4OSADBPA .

mjburton11 commented 4 years ago

Wow that's really sad. Do you think they will ever update?

bqpd commented 4 years ago

Well, more accurately I tested mosek_cli's speed and found it to be just as good as mosek and so didn't bother building out the C-bindings like for Python2 (especially in anticipation of mosek9, though that's still a little slower)

whoburg commented 4 years ago

This seems like a common source of confusion. Would it be worth discussing implementing .solve('mosek') such that it just calls .solve('mosek_cli') so that this is more seamless for users? Or is there a disadvantage to changing the meaning of an existing argument value, 'mosek'?

bqpd commented 4 years ago

it's a problem with an old version of GPkit unfortunately; new updates won't fix it!

bqpd commented 4 years ago
whoburg commented 4 years ago

gotcha

mjburton11 commented 4 years ago

ok so so I'm still confused here. mosek doesn't work with python 3 but mosek_cli does? and does gpkit still support python 2.7?

What are the optimum settings here: python 2.7 or 3? gpkit dev? mosek 9 or 8?

bqpd commented 4 years ago

v0.9.9 is the last one to support Python2.7 and the mosek C-bindings interface for mosek 7/8

the current dev branch does not support either of those :-/

both v0.9.9 and the current dev branch support Python3, mosek 7/8 via the mosek_cli interface and mosek 9 via the mosek_conif interface