LGTM Enterprise 1.23.1

Configuring worker hosts for code analysis

During the analysis of compiled languages, LGTM builds the code. This means that each worker host must be configured with the environment needed to build the codebases that you want to analyze on that machine. Interpreted languages often also depend on the presence of other software in the environment, and these must be made available too.

To set up the required environment for one or more projects, you can set environment variables for all of the worker daemons running on a host, or for groups of one or more workers. You do this in the cluster configuration file—see Setting environment variables for workers.

You may need to set up multiple environments, to build the code for different projects. You can then use labels to determine which workers are used to build specific projects. For more information, see Defining which workers can build and analyze a project.

In this topic

Determining what to install

In general, worker host machines should be set up in much the same way as you set up a continuous integration (CI) slave—with the software and environment required by the projects you plan to analyze on that machine.

Core requirements

The core requirements listed below are the minimum required to analyze code written in each language. Your projects may have additional requirements. Compiled languages have further requirements (detailed in the following section).

Language Essential

Method of building the code (see next table).


Method of building the code (see next table).


Go toolchain (version 1.11 or later)

If dependencies are managed using dep, install version 0.5.0 or later of dep.

If dependencies are managed using Glide, install version 0.13.0 or later of Glide.


Method of building the code (see next table).


No further requirements unless any TypeScript files are present.

If the repository also includes TypeScript files, the TypeScript requirements must be met, or TypeScript analysis disabled.


Access to the pip packaging management system.

Installation of the packaging and virtualenv pip modules.

Ability to download any packages that the Python codebases you intend to analyze depend on.


Node.js version 6.x or later.

Auto-deduction of build commands for compiled languages

For C/C++, C#, and Java code, LGTM Enterprise uses a series of heuristics to determine a suitable set of build commands, using an appropriate build system. This is referred to as "autobuild." For each language, the autobuild process chooses between a set commonly used build systems (listed in the following table), and runs commands for that system. If your organization uses one or more of these build systems, install them on the relevant worker host machines. If some projects use other build systems, you also need to make these systems available. These projects will require a custom build configuration.

Language Automated build configuration available for

Linux workers: Autoconf, CMake, QMake, Meson, WAF, SCons, and Linux KBuild

Windows workers: MSBuild


MSBuild, .NET Core, Mono (Linux), and Visual Studio (Windows)


Gradle, Maven and Ant

If you set up machines with different build environments for different types of project, set worker labels so that you can define which languages/projects are analyzed by each type of worker. For more information about setting worker labels, see Defining which workers can build and analyze a project.

Checking the basic configuration

Linux machines

You can use the lgtm-build-requirements command to check whether the basic dependencies and environment for building/analyzing projects using the default build methods supported by LGTM Enterprise are set up correctly.

On each Linux machine that runs worker daemons, run the command:

sudo lgtm-build-requirements

  • If you're not the root user you need to use sudo to run the lgtm-build-requirements command.

  • If you have deployed LGTM Enterprise on Kubernetes use the following steps to run lgtm-build-requirements within the appropriate Docker container:

    1. Find out the name of the Kubernetes pod for the worker whose environment you want to check:

      kubectl get pods

    2. Get to a command prompt within that Kubernetes pod:

      kubectl exec -it <Kubernetes pod name> -- /bin/bash

      For example:

      kubectl exec -it my-lgtm-worker-general-66b98bfb9d-6chqb -- /bin/bash

    3. Run lgtm-build-requirements as the user named lgtm-worker:

      su lgtm-worker -s /bin/bash -c lgtm-build-requirements

This command checks the machine for the basic checkout and build requirements for each language, and for available version control systems. The availability of each requirement is reported. For example:

[info] Python
[success] python2 found.
[success] pip for python2 found.
[success] packaging for python2 found.
[success] virtualenv for python2 found.
[error] python3 was not found. You are unlikely to be able to analyze any Python 3 projects.

In this example, the command successfully found the core dependencies for Python 2 analysis but not for Python 3 analysis.

Windows machines

For details of the system requirements of Windows machines in the work pool, see System requirements.

Setting up Windows workers

To set up workers on a Windows host machine you must first edit the cluster configuration file (see Adding and removing work pool workers), and then use install-machine.bat to deploy the workers to the host (see Deploying an updated configuration on Windows hosts).

After installing the build tools that you need, check that they are available on the PATH for this account, and that Python 2.7 (required by the workers) is also installed and on the PATH.

Setting up a worker host for JavaScript and TypeScript analysis

Analysis of JavaScript code has no additional dependencies.

If a project includes TypeScript files (.ts and .tsx) you must install Node.js 6.x or later (we recommend the latest LTS version) on any worker host machines that will be used to analyze this code.

Linux machines

Check whether Node is available by running the lgtm-build-requirements command:

[sudo] lgtm-build-requirements

If you have deployed LGTM Enterprise on Kubernetes see the instructions for running lgtm-build-requirements in the note above.

If the command returns the message [warning] node was not found, install Node.js 6.x or later (LTS version recommended).

Windows machines

Check whether Node is available by requesting the version number:

node -v

If the command returns the message 'node' is not recognized..., install Node.js 6.x or later (LTS version recommended) and add it to the PATH.

Setting up a worker host for Python analysis

The following are required:

  • A supported version of Python 3 (for details, see Languages and compilers).

    Python 3 is required even if you are only analyzing Python 2.7.

  • Python 2.7 (in addition to Python 3) if you are going to be analyzing 2.7 code, or if you are setting up a Windows worker host.

    For Windows worker hosts, Python 2.7 is always required (in addition to Python 3), irrespective of the version of Python code you will be analyzing.

  • The pip package installer (in the supported Python versions this should already be installed)

  • The venv module and—if you are going to be analyzing Python 2.7 code—the virtualenv tool.

    venv comes built-in with Python 3, although you will need to run sudo apt-get install python3-venv to make it work on Debian/Ubuntu.

    For more information, see Python Virtual Environments in Five Minutes.

  • The packaging module for both Python 2 and Python 3.

Windows machines

In addition to a supported version of Python 3, and the other requirements listed above, LGTM requires Python 2.7 to be installed, and on the PATH, on all Windows worker hosts. Python 2.7 is required on Windows machines even if you are only analyzing Python 3 code.

Installing Python on Windows

Installing the other requirements on Windows

To check on the availability of pip, run the following command on each worker:

python -m pip --version

If pip is available, the version number is reported. Otherwise an error is reported.

To install pip:

  1. Download get-pip.py to the machine.
  2. Open a command prompt window and navigate to the directory containing get-pip.py.
  3. Run python get-pip.py. This will install pip.
  4. Check that pip is now available. If you still see an error, add pip to the PATH.

To install the packaging and virtualenv modules, run:

  python -m pip install packaging virtualenv

The venv module is installed by default when you install any of the supported Python 3 versions on Windows.

Setting up a worker host for Go analysis

Install the Go toolchain on any machine that hosts worker daemons that will be used to build Go projects. If dependencies are managed using dep or Glide, install these also. See the table above for supported versions.

For projects whose dependencies are not managed using dep or Glide you only need to install the Go toolchain.

Related topicsRelated topics