Search code examples
juliajulia-jump

GLPK Installation Error


I'm working on installing/setting up Julia on a Windows 7 64 bit machine. I'm having issues installing the GLPK package. So far I have tried to completely reinstall Julia with no success. I've tried deleting the .julia folder and my preferences with no success. I always get the following error:

julia> Pkg.build("GLPK")
INFO: Building GLPK
INFO: Attempting to Create directory C:\Users\Justin\.julia\v0.3\GLPK\deps\downl
oads
INFO: Directory C:\Users\Justin\.julia\v0.3\GLPK\deps\downloads already created
INFO: Downloading file http://downloads.sourceforge.net/project/winglpk/winglpk/
GLPK-4.52/winglpk-4.52.zip
INFO: Done downloading file http://downloads.sourceforge.net/project/winglpk/win
glpk/GLPK-4.52/winglpk-4.52.zip
INFO: Attempting to Create directory C:\Users\Justin\.julia\v0.3\GLPK\deps\src
INFO: Directory C:\Users\Justin\.julia\v0.3\GLPK\deps\src already created
INFO: Attempting to Create directory C:\Users\Justin\.julia\v0.3\GLPK\deps
INFO: Directory C:\Users\Justin\.julia\v0.3\GLPK\deps already created
INFO: Attempting to Create directory C:\Users\Justin\.julia\v0.3\GLPK\deps\src\g
lpk-4.52\w32

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Processing archive: C:\Users\Justin\.julia\v0.3\GLPK\deps\downloads\winglpk-4.52
.zip

Error: Can not open file as archive

================================[ ERROR: GLPK ]=================================


failed process: Process(`7z x 'C:\Users\Justin\.julia\v0.3\GLPK\deps\downloads\w
inglpk-4.52.zip' -y '-oC:\Users\Justin\.julia\v0.3\GLPK\deps\src'`, ProcessExite
d(2)) [2]
while loading C:\Users\Justin\.julia\v0.3\GLPK\deps\build.jl, in expression star
ting on line 66

================================================================================


================================[ BUILD ERRORS ]================================


WARNING: GLPK had build errors.

 - packages with build errors remain installed in C:\Users\Justin\.julia\v0.3
 - build the package(s) and all dependencies with `Pkg.build("GLPK")`
 - build a single package by running its `deps/build.jl` script

================================================================================

It seems to me that that the issue is with 'winglpk-4.52.zip' and if I try to directly access and unzip the file, I get an error that says the file is invalid and windows cannot open. I tried deleting GLPK and starting from scratch, no luck there either.

Any ideas or suggestions?

UPDATE: Manually downloaded the file 'winglpk-4.52.zip' and extracting to the location 'C:\Users\Justin.julia\v0.3\GLPK\deps\src' resolves the issue.

HOWEVER, I get another error (not sure if it is related):

Cannot construct an affine expression with a term of type 
(GenericAffExpr{Float64,Variable})*(Float64)
while loading In[6], in expression starting on line 16

 in error at error.jl:21 (repeats 2 times)

This error pertains to the command:

@setObjective(myModel, Max, sum{x[i,j]*data[i,5], i=1:n,j=1:8});

I have Julia installed on my mac and this does NOT give an error..


Solution

  • The second error (from JuMP), looks like because you have the data and variable mixed up - its need to be data * variable (until Julia 0.4 is released and this can be fixed!), i.e.

    @setObjective(myModel, Max, sum{data[i,5]*x[i,j], i=1:n,j=1:8});
    

    I'm not sure why 7z was unable to automatically extract GLPK, but your fix was good. You could file an issue with BinDeps.jl.