How to use Gurobi? - julia

I want to use Gurobi in a program like so:
use Gurobi
To which get the following error message:
ERROR: LoadError: Gurobi not properly installed. Please run Pkg.build("Gurobi"). For
more information go to https://github.com/jump-dev/Gurobi.jl
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] top-level scope at /Users/prikshetsharma/.julia/packages/Gurobi/P6eVP/src/Gurobi.jl:7
[3] include(::Function, ::Module, ::String) at ./Base.jl:380
[4] include(::Module, ::String) at ./Base.jl:368
[5] top-level scope at none:2
[6] eval at ./boot.jl:331 [inlined]
[7] eval(::Expr) at ./client.jl:467
[8] top-level scope at ./none:3
in expression starting at /Users/prikshetsharma/.julia/packages/Gurobi/P6eVP/src/Gurobi.jl:4
ERROR: LoadError: Failed to precompile Gurobi [2e9cd046-0924-5485-92f1-d5272153d98b] to /Users/prikshetsharma/.julia/compiled/v1.5/Gurobi/do9v6_rMyJO.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1305
[3] _require(::Base.PkgId) at ./loading.jl:1030
[4] require(::Base.PkgId) at ./loading.jl:928
[5] require(::Module, ::Symbol) at ./loading.jl:923
[6] include(::Function, ::Module, ::String) at ./Base.jl:380
[7] include(::Module, ::String) at ./Base.jl:368
[8] exec_options(::Base.JLOptions) at ./client.jl:296
[9] _start() at ./client.jl:506
in expression starting at /Users/prikshetsharma/Documents/clotorch/src/clotorch/flight/opt.jl:
When installing Gurobi itself, I get the following error, mentioning a problem with installation and steps to remedy it:
Pkg.build("Gurobi")
Building Gurobi → `~/.julia/packages/Gurobi/P6eVP/deps/build.log`
┌ Error: Error building `Gurobi`:
│ ERROR: LoadError: Unable to locate Gurobi installation. If the advice above did not help,
│ open an issue at https://github.com/jump-dev/Gurobi.jl and post the full
│ print-out of this diagnostic attempt.
│
│ Stacktrace:
│ [1] error(::String) at ./error.jl:33
│ [2] top-level scope at /Users/prikshetsharma/.julia/packages/Gurobi/P6eVP/deps/build.jl:161
│ [3] include(::String) at ./client.jl:457
│ [4] top-level scope at none:5
│ in expression starting at /Users/prikshetsharma/.julia/packages/Gurobi/P6eVP/deps/build.jl:155
│
│ **Unable to locate Gurobi installation. Running some common diagnostics.**
│
│ Gurobi.jl only supports the following versions:
│
│ - gurobi90
│ - gurobi91
│
│ Did you download and install one of these versions from gurobi.com?
│ Installing Gurobi.jl via the Julia package manager is _not_ sufficient!
│
│ Found GUROBI_HOME = /Library/gurobi910/mac64/
│
│ Does this point to the correct install location?
│
│ We're going to look for the Gurobi library in this directory:
│ /Library/gurobi910/mac64/lib
│
│ That directory has the following files:
│
│ Aha! We tried looking in `/Library/gurobi910/mac64/lib`, but something went wrong. Are
│ you sure that your GUROBI_HOME environment variable is correct?
│ When combined with the appropriate suffix (e.g., `lib` or
│ `bin`, it needs to point to a valid directory.
│
│
│ You should set the `GUROBI_HOME` environment variable to point to the
│ install location then try again. For example (updating the path to the
│ correct location if needed):
│ ```
│ # On Windows, this might be
│ ENV["GUROBI_HOME"] = "C:\\Program Files\\gurobi910\\win64\\"
│ import Pkg
│ Pkg.add("Gurobi"
│ Pkg.build("Gurobi")
│
│ # On OSX, this might be
│ ENV["GUROBI_HOME"] = "/Library/gurobi910/mac64/"
│ import Pkg
│ Pkg.add("Gurobi")
│ Pkg.build("Gurobi")
│
│ # On Unix, this might be
│ ENV["GUROBI_HOME"] = "/opt/gurobi910/linux64/"
│ import Pkg
│ Pkg.add("Gurobi")
│ Pkg.build("Gurobi")
│ ```
│ **Note: your path may differ. Check which folder you installed the Gurobi
│ binary in, and update the path accordingly.**
└ # Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:949
I've already following the steps mentioned for macOS in the above trace, but I still get the above error. How to install Gurobi and use it successfully?

You need to install the standalone Gurobi package first. Please follow the instructions in these guides for more info. As was already mentioned in the comments, you should also acquire a license to run Gurobi.

Related

when pushing to heroku and getting an error

trying push my lita code to heroku but I'm getting this error.
❯ git push heroku master │
Enumerating objects: 2, done. │
Counting objects: 100% (2/2), done. │
Writing objects: 100% (2/2), 165 bytes | 165.00 KiB/s, done. │
Total 2 (delta 0), reused 0 (delta 0), pack-reused 0 │
remote: error: pathspec '.' did not match any file(s) known to git. │
remote: │
remote: ! Heroku Git error, please try again shortly. │
remote: ! See http://status.heroku.com for current Heroku platform status. │
remote: ! If the problem persists, please open a ticket │
remote: ! on https://help.heroku.com/tickets/new │
remote: ! and provide the Request ID 693daaca-96b5-4889-99c9-391d66a59249 │
remote: │
To https://git.heroku.com/ancient-stream-43362.git │
! [remote rejected] master -> master (pre-receive hook declined) │
error: failed to push some refs to 'https://git.heroku.com/ancient-stream-43362.git'
I do not know what files that arent known to git.
Was in a branch than the master branch and unless specified in the Heroku push command it will by default look for the master branch.

IOError: stream is closed or unusable on a new genie App

I created a new Genie App as described here. :
Genie.newapp("MyGenieApp")
with routes.jl looking like that:
using Genie.Router
route("/") do
serve_static_file("welcome.html")
end
route("/hello")do
"Welcome to Genie"
end
But when accessing http://127.0.0.1:8000/ , the generic 404-Not-Found Page is shown, and this error is printed to the console:
julia> ┌ Error: / 404
└ # Genie.Router C:\Users\User\.julia\packages\Genie\1gtMT\src\Router.jl:150
┌ Error: error handling request
│ exception =
│ IOError: stream is closed or unusable
│ Stacktrace:
│ [1] check_open at .\stream.jl:328 [inlined]
│ [2] uv_write_async(::Sockets.TCPSocket, ::Ptr{UInt8}, ::UInt64) at .\stream.jl:961
│ [3] uv_write(::Sockets.TCPSocket, ::Ptr{UInt8}, ::UInt64) at .\stream.jl:924
│ [4] unsafe_write(::Sockets.TCPSocket, ::Ptr{UInt8}, ::UInt64) at .\stream.jl:1007
│ [5] unsafe_write at C:\Users\User\.julia\packages\HTTP\nMACo\src\ConnectionPool.jl:174[inlined]
│ [6] macro expansion at .\gcutils.jl:91 [inlined]
│ [7] write at .\strings\io.jl:186 [inlined]
│ [8] writeheaders(::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::HTTP.Messages.Response) at C:\Users\User\.julia\packages\HTTP\nMACo\src\Messages.jl:439
│ [9] startwrite(::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}) at C:\Users\User\.julia\packages\HTTP\nMACo\src\Streams.jl:85
│ [10] handle(::HTTP.Handlers.RequestHandlerFunction{Genie.AppServer.var"#6#12"}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}) at C:\Users\User\.julia\packages\HTTP\nMACo\src\Handlers.jl:278
│ [11] #4 at C:\Users\User\.julia\packages\HTTP\nMACo\src\Handlers.jl:345 [inlined]
│ [12] macro expansion at C:\Users\User\.julia\packages\HTTP\nMACo\src\Servers.jl:367 [inlined]
│ [13] (::HTTP.Servers.var"#13#14"{HTTP.Handlers.var"#4#5"{HTTP.Handlers.RequestHandlerFunction{Genie.AppServer.var"#6#12"}},HTTP.ConnectionPool.Transaction{Sockets.TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})() at .\task.jl:333
Does someone have a clue, what I am doing wrong?
The problem was this line:
Genie.newapp("MyGenie App")
instead of using CamelCase, I actually hat a space in here. Because Genie creates files and variables with this name, a space is not allowed here.

Issues on using Plots package in Julia

I'm trying to use Plots package in Julia but I get an error message I don't fully understand. Using a Jupyter notebook I followed the canonic way to install and use the package with:
Pkg.add("Plots")
using Plots
But after then I got this error message:
INFO: Precompiling module Plots.
WARNING: Module Compat with uuid 131681569370755 is missing from the cache.
This may mean module Compat does not support precompilation but is imported by a module that does.
ERROR: LoadError: Declaring __precompile__(false) is not allowed in files that are being precompiled.
Stacktrace:
[1] _require(::Symbol) at .\loading.jl:455
[2] require(::Symbol) at .\loading.jl:405
[3] include_from_node1(::String) at .\loading.jl:576
[4] include(::String) at .\sysimg.jl:14
[5] anonymous at .\<missing>:2
while loading C:\Users\Alex\.julia\v0.6\StaticArrays\src\StaticArrays.jl, in expression starting on line 17
ERROR: LoadError: Failed to precompile StaticArrays to C:\Users\Alex\.julia\lib\v0.6\StaticArrays.ji.
Stacktrace:
[1] compilecache(::String) at .\loading.jl:710
[2] _require(::Symbol) at .\loading.jl:463
[3] require(::Symbol) at .\loading.jl:405
[4] include_from_node1(::String) at .\loading.jl:576
[5] include(::String) at .\sysimg.jl:14
[6] anonymous at .\<missing>:2
while loading C:\Users\Alex\.julia\v0.6\Plots\src\Plots.jl, in expression starting on line 7
Failed to precompile Plots to C:\Users\Alex\.julia\lib\v0.6\Plots.ji.
Stacktrace:
[1] compilecache(::String) at .\loading.jl:710
[2] _require(::Symbol) at .\loading.jl:497
[3] require(::Symbol) at .\loading.jl:405
[4] include_string(::String, ::String) at .\loading.jl:522
Could somebody please help me to understand this error and what can I do to fix it? Any help will be much appreciated.
That's because you already had Compat in your scope before trying to update. It then has an issue of trying to precompile using a new version of Compat while an old one is still in scope. To fix this, just restart Julia and do using Plots.

IJulia for Julia v0.7

I tried building the latest (dev) version of Julia (v0.7) and want to use this kernel from Jupyter Notebook. When I tried running
Pkg.add("IJulia") and building the module, the build failed. The errors I get are along the lines of
Error: ------------------------------------------------------------
│ # Build failed for IJulia
│ exception =
│ LoadError: UndefVarError: JULIA_HOME not defined
│ Stacktrace:
│ [1] uv_error at ./libuv.jl:68 [inlined]
│ [2] unlink(::String) at ./file.jl:526
│ [3] #rm#9(::Bool, ::Bool, ::Function, ::String) at ./file.jl:149
│ [4] #rm at ./<missing>:0 [inlined]
│ [5] #installkernel#2(::String, ::Function, ::String) at /Users/myuser/.julia/v0.7/IJulia/deps/kspec.jl:117
│ [6] installkernel(::String) at /Users/myuser/.julia/v0.7/IJulia/deps/kspec.jl:36
│ [7] top-level scope at /Users/myuser/.julia/v0.7/IJulia/deps/build.jl:75
│ [8] include at ./boot.jl:295 [inlined]
│ [9] include_relative(::Module, ::String) at ./loading.jl:1067
│ [10] include at ./sysimg.jl:26 [inlined]
│ [11] include(::String) at ./loading.jl:1101
│ [12] top-level scope
│ [13] eval at ./boot.jl:298 [inlined]
│ [14] eval at ./sysimg.jl:71 [inlined]
│ [15] evalfile(::String, ::Array{String,1}) at ./loading.jl:1096 (repeats 2 times)
│ [16] #2 at ./none:15 [inlined]
│ [17] cd(::getfield(, Symbol("##2#5")){String}, ::String) at ./file.jl:70
│ [18] (::getfield(, Symbol("##1#3")))(::IOStream) at ./none:14
│ [19] #open#318(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::getfield(, Symbol("##1#3")), ::String, ::Vararg{String,N} where N) at ./iostream.jl:369
│ [20] open(::Function, ::String, ::String) at ./iostream.jl:367
│ [21] top-level scope
│ [22] eval at ./boot.jl:298 [inlined]
│ [23] eval(::Module, ::Expr) at ./sysimg.jl:71
│ [24] exec_options(::Base.JLOptions) at ./client.jl:309
│ [25] _start() at ./client.jl:448
│ in expression starting at /Users/myuser/.julia/v0.7/IJulia/deps/build.jl:104
└ # Main none:18
Is it reasonable to post this as an issue on the github, or are the issues only supposed to be for the stable release v0.6?
In the upcoming Julia v0.7, the variable JULIA_HOME (from the Base module) has been renamed to Sys.BINDIR [1].
After having a look to the repository, it seems that they are currently porting IJulia to version 0.7. I don't think that it hurts to file an issue given now that you have the solution how to fix this particular issue. Also this particular error message does not show in continuous integration builds [2]. However, there a probably many other issues given the long list of changes [1] and since version 0.7 has not yet been released. Thus do not expect IJulia to to work with Julia v0.7 (dev) after this change.
[1] https://github.com/JuliaLang/julia/blob/master/NEWS.md
[2] https://travis-ci.org/JuliaLang/IJulia.jl/jobs/336988585

Sage command line `reset()` fails to create exit command

I'm using the Sage command line interface, started from a Linux shell. Normally, typing exit <return> exits the command line and takes me back to the shell. However, if I use the reset() command during a session, this no longer works:
[matthew#tera ~]$ /usr/local/sage/sage-6.2-x86_64-Linux/sage
┌────────────────────────────────────────────────────────────────────┐
│ Sage Version 6.2, Release Date: 2014-05-06 │
│ Type "notebook()" for the browser-based notebook interface. │
│ Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: exit
Exiting Sage (CPU time 0m0.14s, Wall time 0m4.70s).
[matthew#tera ~]$
[matthew#tera ~]$ /usr/local/sage/sage-6.2-x86_64-Linux/sage
┌────────────────────────────────────────────────────────────────────┐
│ Sage Version 6.2, Release Date: 2014-05-06 │
│ Type "notebook()" for the browser-based notebook interface. │
│ Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: reset()
sage: exit
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
/usr/local/sage/sage-6.2-x86_64-Linux/local/lib/python2.7/site-packages /sage/all_cmdline.py in <module>()
----> 1 exit
NameError: name 'exit' is not defined
sage:
Note that quit does not work either.
So, it appears that the reset() function wipes exit from the namespace along with any user variables, and fails to recreate it, as it does x, the predefined symbolic variable, for instance.
Is this a reportable bug, or am I missing something?
Is there an alternate way to exit the Sage command line? I've gotten stuck in it a few times, and I end up hitting Ctrl-z and then ending the shell session; this seems both messy and bad, as I'm causing the shell to kill the Sage process.
Is there an alternate way to exit the Sage command line?
I usually use Ctrl-D in any case...
But this does indeed appear to be a problem. Note that this is an Ipython thing, so maybe reset is supposed to get rid of the magic things - but I don't see why. I have opened Trac 16704, though it's possible it's desired behavior because it's Ipython.

Resources