Gurobi can be used in WSL2. You have two options outlined below to get set up with your Gurobi license.
Option 1: Using a floating Gurobi license [Recommended]
The easiest option is to connect to a floating license server: How do I check the availability of floating license tokens?
Please note that we are also working to make our Web License Service compatible with WSL2.
Option 2: Using an individual Gurobi License
To use an individual license, please follow these instructions:
The Windows Subsystem for Linux, specifically version 2, does not have a persistent network address. This means that a new MAC address will be assigned to the network adapter after every reboot of the Windows host machine. Gurobi uses these network adapters to identify the machine and validate the license, so a simple reboot of the machine may render the license invalid.
Until there is a proper solution to have a static and persistent MAC address in WSL2 natively, you may use the approach suggested in WSL issue #5352:
You need to add these lines to the
.bashrc of your WSL user:
# get a persistent MAC address for bond0 and rename it eth1
if ! ip link show | grep -q $mac; then
sudo ip link set dev bond0 down
sudo ip link set dev bond0 address $mac
sudo ip link set dev bond0 name eth1
sudo ip link set dev eth1 up
You should run
grbprobe adapters first and use the MAC address of the
bond0 adapter to set the
mac variable in that script to match your current setup. After a reboot, the
eth1 address will stay the same and you can use it to bind the Gurobi license to your WSL by following these steps:
- get a new academic license
grbprobe --adapter eth1 --output wsl2-hostinfo.txtto store the
eth1info in the file
grbgetkey xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx --input wsl2-hostinfo.txtusing your personal license key and the hostinfo file.
Please note that you will need to enter your sudo password when starting the WSL for the first time to apply the network changes defined in your
- How do I check the availability of floating license tokens?
- How do I renew an academic site (floating) license?
- How do I use the command line on Windows?