Gurobi Install Ubuntu

4 views
Skip to first unread message

Liese Hittson

unread,
Aug 4, 2024, 9:13:18 PM8/4/24
to flalevmalde
Gurobiis the most powerful and fastest solver that the prioritizr R package can use to solve conservation planning problems (see the Solver benchmarks vignette for further details). This guide will walk you through the process of setting up Gurobi on your computer so that it can be used to solve conservation planning problems. If you encounter any problems while following the instructions below, please refer to the official Gurobi documentation.

Gurobi is a commercial computer program. This means that users will need to obtain a license for Gurobi before they can use it. Although academics can obtain a special license at no cost, individuals that are not affiliated with a recognized educational institution may need to purchase a license. If you are an academic that is affiliated with a recognized educational institution, you can take advantage of the special academic license to use Gurobi for no cost. Once you have signed up for a free account you can request a free academic license.


After obtaining a license, you will need to download the Gurobi installer to your computer. To achieve this, visit the Gurobi downloads web page and download the correct version of the installer for your operating system.


Next, we will now check that the license has been successfully activated. To achieve this, we will try running Gurobi directly from the command line. Note that the following commands assume you are using version 8.0.0 of Gurobi, and so you will need to modify the command if you are using a more recent version (e.g., if using version 9.1.2, then use gurobi912 instead of gurobi800 below).


After activating the license, you now need to install the gurobi R package. This is so that you can access the Gurobi software from within the R statistical computing environment, and enable the prioritizr package to interface with the Gurobi software.


Now we will install the gurobi R package. This package is not available on the Comprehensive R Archive Network and is instead distributed with the Gurobi software suite. Specifically, the gurobi R package should be located within the folder where you installed the Gurobi software suite. We will install the gurobi R package by running the following R code within your R session. Note that the following code assumes that you are using version 8.0.0 of Gurobi, and so you will need to modify the code if you are using a more recent version (e.g., if using version 9.1.2, then use gurobi912 instead of gurobi800 below).


Next, you will need to install the slam R package because the gurobi R package needs this package to work. Users of all platforms (i.e., Windows, Linux, and MacOS) can install the package using the following R code.


If you successfully installed the Gurobi software suite and the gurobi R package, you can now try solving conservation planning problems using the prioritzr R package. Although the prioritizr R package should automatically detect that Gurobi has been installed, you can use the function add_gurobi_solver() to manually specify that Gurobi should be used to solve problems. This function is also useful because you can use it to customize the optimization process (e.g., specify the desired optimality gap or set a limit on how much time should be spent searching for a solution).


After running this code, hopefully, you should some information printed on-screen about the optimization process and R should produce a map displaying a solution. If this code does not produce any errors, then you have successfully installed everything and can begin using Gurobi and the prioritizr R package to solve your very own conservation planning problems.


From 1.4.0b20 on we distribute ilastik with additional GPU-enabled builds for Windows and Linux.With these you can run pre-trained neural network models from the bioimage.io Model Zoo faster, if you have a compatible nvidia GPU on your system.All other workflows, besides the Neural Network Workflow (local) will work exactly like before.


If you are interested in running ilastik on a remote GPU, e.g. if you have a powerful server in your facility, you have to check for additional installation instructions for the server part in the tiktorch repository.After you install the server part, you can use your regular ilastik installation as a client with the Neural Network Workflow (remote), ilastik will take care of the communication with the server.


On Mac, Linux, and Windows learning the weights in the Tracking with Learning Workflow requires a commercial solver (CPLEX or Gurobi).In order to enable this the Tracking with Leaning Workflow, please follow the instructions in the section about commercial solver installation.


Download the Windows self-extracting installer and run it.The installer will guide you through the installation process.You can find an entry for ilastik in the start menu and click it to launch the program.


ilastik will check for two environment variables on startup that control resource usage: LAZYFLOW_THREADS, and LAZYFLOW_TOTAL_RAM_MB.Note, these environment variables overrule any settings made in a config file (see below).


Application for an academic license is available after registration with your institution email address at the GUROBI website.Details can be found here.The easiest way is to obtain a free named-user academic license.Instructions are provided on this page.At the end of the process, you will be provided with your license key.Note that this license is only valid for a limited amount of time (currently this period is two months, but this could be subject to change).You will need the license key to activate your GUROBI installation.


Double click the Gurobi-9.0.3-win64.msi installer to go through the installation process.Restart your computer to complete the installation.Once the installation is complete, you need to activate the license.You can review all your current licenses here.Licenses without an entry in the Host Name column have not been assigned a computer yet.Click on one of those to get to a new page with instructions.On the bottom of this page you will find a line like:


Note: Due to a bug in ilastik 1.3.3 the solver library is not recognized.If you absolutely have to use this version then a solution is to manually copy C:\gurobi811\win64\bin\gurobi811.dll to your ilastik installation folder, e.g. C:\Program Files\ilastik-1.3.3post3\Library\bin.


Activate your installation by invoking grbgetkey with your license.You can review all your current licenses here.Licenses without an entry in the Host Name column have not been assigned a computer yet.Click on one of those to get to a new page with instructions.On the bottom of this page you will find a line like:


In the next step you have to execute a script that will link your GUROBI libraries to your ilastik installation.The script can be found in your-ilastik-installation-folder/ilastik-meta/ilastik/scripts.


IBM CPLEX is a commercial solver which is free for academic use.Details on the application for an academic license, may be found onthe IBM Academic Initiative website.Please note that it might take some days until the application gets approved by IBM.


The current version of ilastik works withIBM ILOG CPLEX Optimization Studio V12.9.After choosing the appropriate platform, you have to agree with the IBM license.Finally, CPLEX may be downloaded and is ready to install.


Important note: It is not sufficient to download the Trial version of CPLEX since its solver can only handlevery small problem sizes. Please make sure, the correct version is downloaded as described here.


CPLEX packages for Linux and Mac do not provide shared versions of all required libraries, but only static variants.In order to enable CPLEX with ilastik, the static libraries have to be converted.Before you can convert your static CPLEX libraries into shared library versions, you need to have a compiler installed on your machine.You can check whether you already have a compiler installed by running the following command in a terminal (open the Terminal app!).


Now you can run a script, that will convert your CPLEX static libraries into shared libraries, and install them into the appropriate directory of your ilastik directory.Starting with ilastik-1.1.7, this script can be found in ilastik-1.*.*/ilastik-meta/ilastik/scripts.Prior to that version the script needs to be downloaded manually in the terminal:


I'm building a dashboard that will need to execute some Julia code, using the JuliaCall package. Moreover, within Julia I will need to call Gurobi. My question is whether I would be able to host such a dashboard on shinyapps.io, Will rsconnect (or some other method, even ssh/command line) let me install the julia/gurobi distros that I need on the shinyapps server so that my dashboard can call them? I'm trying to avoid setting up/maintaining my own website and back-end shiny server but I'm guessing that might be the only option.


As for Gurobi, I don't know anything about that. In general you are able to write to the application's directory, so your code could install Gurobi local to itself. Alternatively, if there is an R package wrapper, you could open an issue or pull request per the documentation


also, you should think about your infrastructure setup.

If you are using Julia and Gurobi, then you probably have some beefy computations running.

It might make more sense to separate the Shiny app and Julia/Gurobi portion into 2 separate services.

shinyapps.io is great but wouldn't be my pick to run a heavy computation or big optimization problem.

Gurobi also has a managed service.


Were you able to build the app using JuliaCall? I'm currently building an app that uses Julia and although it runs locally I'm having issues when deploying. I'm wondering if you had success and, if so, how.


Adding a mere JuliaCall::julia_call("println", "hello world!") results in a segfault. Could that be due to JuliaCall having to be synced with a certain Julia version? If so, would be great to have the currently supported range of JuliaCall (r package versions) documented somewhere.

3a8082e126
Reply all
Reply to author
Forward
0 new messages