Windows#

To install LabGym on Windows, you will need to access the terminal. To do this, open the start menu by clicking the Win key, type “PowerShell”, and hit enter. All terminal commands going forward should be entered in this terminal.

Warning

There is a known issue with LabGym that prevents it from running on Windows 11. If you are on Windows 11, we suggest using Windows Subsystem for Linux (WSL) and following along with the Linux installation instructions.

  1. Install Git.

    If you’re unsure of which installation method to use, select the 64-bit Git for Windows Setup option. Run the installer, and accept all default values.

  2. Install the Visual Studio C++ Build Tools.

    Scroll down to the entry that says Build Tools for Visual Studio 2022 and click “Download”.

    VS Build Tools Website Screenshot

    When you run the downloaded executable, you will be prompted to choose what tools you will need. Select only the Desktop Development With C++ workload, then click “Install”.

    VS Build Tools Installer Screenshot

  3. Install Python 3.10. Scroll down to the bottom and click the Windows installer (64-bit) option. Run the installer and accept all default options.

    To test your Python installation, run the following command. If the version number prints out successfully, your Python installation is working.

    > py -3.10 --version
    Python 3.10.10
    
  4. If you’re using an Nvidia GPU, install CUDA Toolkit 11.8 and cuDNN.

    First, install and/or update your GPU drivers at this link. Select your GPU model and click “Search”, then click “Download”. After installing the drivers, reboot your system to ensure they take effect.

    Then, install CUDA Toolkit 11.8. Select your version of Windows, select “exe (local),” then click “Download.”

    Warning

    If you’re using Windows Subsystem for Linux (WSL), please refer to the Linux install instructions.

    To verify your installation of CUDA, use the following command.

    > set CUDA_HOME=%CUDA_HOME_V11_8%
    > nvcc --version
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2022 NVIDIA Corporation
    Built on Wed_Sep_21_10:41:10_Pacific_Daylight_Time_2022
    Cuda compilation tools, release 11.8, V11.8.89
    Build cuda_11.8.r11.8/compiler.31833905_0
    

    Finally, install cuDNN. You will need to register an Nvidia Developer account, which you can do for free.

    Important

    If you’re using Windows 11, when installing cuDNN, select “Tarball” then “11” under CUDA Version. Then, follow these instructions to install cuDNN from the .tar.gz file.

    As of February 2024, the latest version is cuDNN 9.0.0, which is compatible with CUDA 11.8.

  5. Install pipx by following these instructions.

    To test your installation of pipx, close and reopen your terminal window, then type the following command:

    > pipx --version
    1.4.3
    

    If the version number prints successfully, then your installation is working properly. Otherwise, try running the pipx ensurepath command again.

  6. Install LabGym via pipx.

    > pipx install --python 3.10 LabGym
    
  7. Install PyTorch in LabGym’s virtual environment.

    > pipx inject --index-url https://download.pytorch.org/whl/cu118 LabGym torch==2.0.1 torchvision==0.15.2
    

    If you are using LabGym without a GPU, use the following command instead.

    > pipx inject --index-url https://download.pytorch.org/whl/cpu LabGym torch==2.0.1 torchvision==0.15.2
    
  8. Install Detectron2 in LabGym’s virtual environment.

    First, download the Detectron2 code using the following command.

    > git clone https://github.com/facebookresearch/detectron2.git
    

    The code should be available in the C:\Users\<username>\detectron2\ folder.

    If you’re using a GPU, open the setup.py file inside the detectron2 folder using a text editor (e.g. Notepad, VS Code, etc.). Go to line 79 in the code, then apply the following edit.

    Old version:

    72if not is_rocm_pytorch:
    73    define_macros += [("WITH_CUDA", None)]
    74    extra_compile_args["nvcc"] = [
    75        "-O3",
    76        "-DCUDA_HAS_FP16=1",
    77        "-D__CUDA_NO_HALF_OPERATORS__",
    78        "-D__CUDA_NO_HALF_CONVERSIONS__",
    79        "-D__CUDA_NO_HALF2_OPERATORS__",
    80    ]
    81else:
    82    define_macros += [("WITH_HIP", None)]
    83    extra_compile_args["nvcc"] = []
    

    New version:

    72if not is_rocm_pytorch:
    73    define_macros += [("WITH_CUDA", None)]
    74    extra_compile_args["nvcc"] = [
    75        "-O3",
    76        "-DCUDA_HAS_FP16=1",
    77        "-D__CUDA_NO_HALF_OPERATORS__",
    78        "-D__CUDA_NO_HALF_CONVERSIONS__",
    79        "-D__CUDA_NO_HALF2_OPERATORS__",
    80        "-DWITH_CUDA",
    81    ]
    82else:
    83    define_macros += [("WITH_HIP", None)]
    84    extra_compile_args["nvcc"] = []
    

    Save the setup.py file, then exit your text editor.

    Finally, reopen your terminal, then install Detectron2.

    > set CUDA_HOME=%CUDA_HOME_V11_8%
    > pipx runpip LabGym install -e detectron2
    
  9. Launch LabGym.

    > LabGym
    

    The GUI will take a few minutes to start up during the first launch. If the LabGym GUI shows up, you have successfully installed LabGym!