The build process can be quite long and tedious. The **[F.A.Q.](build_faq.md)** page offers solution for the most common complications. Alternatively, use the [CARLA forum](https://forum.carla.org/c/installation-issues/linux) to post any unexpected issues that may occur.
To execute the <code>make</code> commands below, you <b>must</b> use the Visual Studio 2017 native console x64 <b>with</b> administrator rights, otherwise you may be getting permission errors.
To execute the ```make``` commands below, you **must** use the Visual Studio 2017 native console x64 **with** administrator rights, otherwise you may be getting permission errors.
* __x64 system.__ The simulator should run in any 64 bits Windows system.
* __30GB disk space.__ Installing all the software needed and CARLA will require quite a lot of space. Make sure to have around 30/50GB of free disk space.
* __An adequate GPU.__ CARLA aims for realistic simulations, so the server needs at least a 4GB GPU. A dedicated GPU is highly recommended for machine learning.
* __Two TCP ports and good internet connection.__ 2000 and 2001 by default. Be sure neither the firewall nor any other application are blocking these.
* [__CMake__](https://cmake.org/download/) generates standard build files from simple configuration files.
* [__Git__](https://git-scm.com/downloads) is a version control system to manage CARLA repositories.
* [__Make__](http://gnuwin32.sourceforge.net/packages/make.htm) generates the executables.
* [__Python3 x64__](https://www.python.org/downloads/) is the main script language in CARLA. Having a x32 version installed may cause conflict, so it is highly advisable to have it uninstalled.
Be sure that these programs are added to the [environment path](https://www.java.com/en/download/help/path.xml). Remember that the path added leads to the _bin_ directory.
Get the 2017 version from [here](https://developerinsider.co/download-visual-studio-2017-web-installer-iso-community-professional-enterprise/). __Community__ is the free version. Use the _Visual Studio Installer_ to install two additional elements.
* __Windows 8.1 SDK.__ Select it in the _Installation details_ section on the right.
* __x64 Visual C++ Toolset.__ In the _Workloads_ section, choose __Desktop development with C++__. This will enable a x64 command prompt that will be used for the build. Check it up by pressing the `Win` button and searching for `x64`. Be careful to __not open a `x86_x64` prompt__.
Other Visual Studio versions may cause conflict. Even if these have been uninstalled, some registers may persist. To completely clean Visual Studio from the computer, go to `Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\layout` and run `.\InstallCleanup.exe -full`
Since CARLA 0.9.11, we have included some fixes to the engine that requires to modify it so it is no longer possible to use the Unreal Engine version provided by Epic Games Launcher. To build this modified version, we need to download the engine's code from source and then apply some patches that we provide. Be aware that to download the Unreal Engine's source code, you need to have a Github account linked to the Unreal's account. If you do not have it, please follow [this guide](https://www.unrealengine.com/en-US/ue4-on-github) before going any further.
* __1.__ Open a terminal, go to the folder in which you want to save Unreal Engine and, clone the 4.24 branch on your computer.
* __4.__ Now, we need to compile the engine. Open the __UE4.sln__ file inside the source folder with Visual Studio (Epic recommends 2017 or 2019 versions). Make sure that in the build bar, it is selected the 'Development Editor', 'Win64' and, 'UnrealBuildTool' options. Check [this guide](https://docs.unrealengine.com/en-US/ProductionPipelines/DevelopmentSetup/BuildingUnrealEngine/index.html) if you need any help. Then, in the solution explorer, right-click in __UE4__ and select __Build__.
* __5.__ Once the solution is compiled you can open the engine to check that everything was correct launching the executable `Engine\Binaries\Win64\UE4Editor.exe`.
If the installation was successful, this should be recognised by the Unreal Engine's version
selector and when you use __Switch Unreal Engine version__ when right-clicking on __.uproject__ files, it should appear as __Source Build at PATH__ where PATH is the installation path that you have chosen. If you can not see this selector or the __Generate Visual Studio project files__ when you right-click on __.uproject__ files, something went wrong with the UE4 installation and probably you need to reinstall it correctly.
The `master` branch contains the latest fixes and features. Stable code is inside the `stable` and previous CARLA versions have their own branch. Always remember to check the current branch in git with the command `git branch`.
Only the assets package is yet to be downloaded. `\Util\ContentVersions.txt` contains the links to the assets for CARLA releases. These must be extracted in `Unreal\CarlaUE4\Content\Carla`. If the path doesn't exist, create it.
This is necessary for CARLA to find the Unreal Engine installation folder. By doing so, users can choose which specific version of Unreal Engine is to be used. If no environment variable is specified, the CARLA will look up in the directories and use the last version in search order.
__1. Open the Windows Control Panel__ and go to `Advanced System Settings`.
__2. On the `Advanced` panel__ open `Environment Variables...`.
__3. Click `New...`__ to create the variable.
__4. Name the variable as `UE4_ROOT`__ and choose the path to the installation folder of the desire UE4 installation.
Make sure to run `make PythonAPI` to prepare the client and `make launch` for the server.
Alternatively `make LibCarla` will prepare the CARLA library to be imported anywhere.
* __make PythonAPI__ compiles the API client, necessary to grant control over the simulation. It is only needed the first time. Remember to run it again when updating CARLA. Scripts will be able to run after this command is executed.
* __make launch__ compiles the server simulator and launches Unreal Engine. Press **Play** to start the spectator view and close the editor window to exit. Camera can be moved with `WASD` keys and rotated by clicking the scene while moving the mouse around.
The project may ask to build other instances such as `UE4Editor-Carla.dll` the first time. Agree in order to open the project. During the first launch, the editor may show warnings regarding shaders and mesh distance fields. These take some time to be loaded and the city will not show properly until then.
Finally, let's test the simulator. Inside `PythonAPI/examples` and `PythonAPI/util` there are some example scripts that may be especially useful for starters. The following commands will spawn some life into the town, and create a weather cycle. Each script should be run in one terminal
If the simulation is running at very low FPS rates, go to `Edit/Editor preferences/Performance` in the UE editor and disable __Use less CPU when in background__.
Read the **[F.A.Q.](build_faq.md)** page or post in the [CARLA forum](https://forum.carla.org/c/installation-issues/linux) for any issues regarding this guide.
Some recommendations after finishing the build. Learn how to update the CARLA build or take your first steps in the simulation, and learn some core concepts.