[NO_BUILD] Added first draft of python wheel documentation (#4325)
* Added first draft of python wheel documentation * Removed the 2 from pip2 * Updated wheel flag info and linux requirements * Updated build docs with information about whl's and egg's * Updated installation and build docs to reflect the new ways to install the client library * Removed summary sections from build docs. The process is too complicated and open to mistakes if users follow a summary * Corrections on python wheel docs * Removed python version references * Removing/fixing irrelevant parts of the docs and fixing example code snippets. * Corrected python versions on windows and quickstart and removed repair wheel flag on linux
This commit is contained in:
parent
4d04b4ae29
commit
d4ead18adc
|
@ -58,6 +58,7 @@ CARLA forum</a>
|
||||||
* [Fatal error: 'version.h' has been modified since the precompiled header.](#fatal-error-versionh-has-been-modified-since-the-precompiled-header)
|
* [Fatal error: 'version.h' has been modified since the precompiled header.](#fatal-error-versionh-has-been-modified-since-the-precompiled-header)
|
||||||
* [Create a binary version of CARLA.](#create-a-binary-version-of-carla)
|
* [Create a binary version of CARLA.](#create-a-binary-version-of-carla)
|
||||||
* [Can I package CARLA for Windows on a Linux machine and vice versa?](#can-i-package-carla-for-windows-on-a-linux-machine-and-vice-versa)
|
* [Can I package CARLA for Windows on a Linux machine and vice versa?](#can-i-package-carla-for-windows-on-a-linux-machine-and-vice-versa)
|
||||||
|
* [How do I uninstall the CARLA client library?](#how-do-i-uninstall-the-carla-client-library)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -141,11 +142,16 @@ CARLA forum</a>
|
||||||
> ![faq_rpc_error](img/faq_rpc_error.jpg)
|
> ![faq_rpc_error](img/faq_rpc_error.jpg)
|
||||||
>
|
>
|
||||||
> If running a script returns an output similar to this, there is a problem with the `.egg` file in the PythonAPI.
|
> If running a script returns an output similar to this, there is a problem with the `.egg` file in the PythonAPI.
|
||||||
|
|
||||||
|
!!! Important
|
||||||
|
If you are using 0.9.12+, there are several methods to use/install the client library. If you are using one of the newer methods for the client library (`.whl` or PyPi download) the information in this section will not be relevant to you.
|
||||||
>
|
>
|
||||||
> First of all, open `<root_carla>/PythonAPI/carla/dist`. There should be an `.egg` file for the corresponding CARLA and Python version you are using (similar to `carla-0.X.X-pyX.X-linux-x86_64.egg`). Make sure the file matches the Python version you are using. To check your Python version use the following command.
|
> First of all, open `<root_carla>/PythonAPI/carla/dist`. There should be an `.egg` file for the corresponding CARLA and Python version you are using (similar to `carla-0.X.X-pyX.X-linux-x86_64.egg`). Make sure the file matches the Python version you are using. To check your Python version use the following command.
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
> python3 --version # CARLA no longer provides support for Python2, so we are dismissing it here
|
> python3 --version
|
||||||
|
> # or for Python 2
|
||||||
|
> python --version
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
> If either the file is missing or you think it could be corrupted, try rebuilding again.
|
> If either the file is missing or you think it could be corrupted, try rebuilding again.
|
||||||
|
@ -335,6 +341,12 @@ CARLA forum</a>
|
||||||
|
|
||||||
> This error occurs because Python cannot find the CARLA library. The CARLA library is contained in an `.egg` file, located in the directory `PythonAPI/carla/dist` and all the example scripts will look for it in this directory. The `.egg` file follows the nomenclature of `carla-<carla-version>-py<python-version>-<operating-system>.egg`.
|
> This error occurs because Python cannot find the CARLA library. The CARLA library is contained in an `.egg` file, located in the directory `PythonAPI/carla/dist` and all the example scripts will look for it in this directory. The `.egg` file follows the nomenclature of `carla-<carla-version>-py<python-version>-<operating-system>.egg`.
|
||||||
>
|
>
|
||||||
|
|
||||||
|
!!! Important
|
||||||
|
CARLA only used `.egg` files for the client library in versions prior to 0.9.12. If you are using 0.9.12+, there are several methods to use/install the client library. If you are using one of the newer methods for the client library (`.whl` or PyPi download) the information in this section will not be relevant to you.
|
||||||
|
|
||||||
|
Read more about the newer methods to use/install the client library in the [__Quickstart tutorial__](start_quickstart.md#carla-0912).
|
||||||
|
|
||||||
>If you are using a packaged version of CARLA, there will be several `.egg` files, corresponding to different versions of Python, depending on the version of CARLA. Make sure you are running the scripts with one of these Python versions. To check the default Python version, type the following into the command line:
|
>If you are using a packaged version of CARLA, there will be several `.egg` files, corresponding to different versions of Python, depending on the version of CARLA. Make sure you are running the scripts with one of these Python versions. To check the default Python version, type the following into the command line:
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
|
@ -390,4 +402,17 @@ CARLA forum</a>
|
||||||
|
|
||||||
>Although this feature is available for Unreal Engine, it is not available in CARLA. We have a number of dependencies that are not supported to be cross compiled.
|
>Although this feature is available for Unreal Engine, it is not available in CARLA. We have a number of dependencies that are not supported to be cross compiled.
|
||||||
|
|
||||||
|
<!-- ======================================================================= -->
|
||||||
|
###### How do I uninstall the CARLA client library?
|
||||||
|
|
||||||
|
>If you installed the client library using __pip/pip3__, you should uninstall it by running:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Python 3
|
||||||
|
pip3 uninstall carla
|
||||||
|
|
||||||
|
# Python 2
|
||||||
|
pip uninstall carla
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
|
@ -16,7 +16,6 @@ If you come across errors or difficulties then have a look at the **[F.A.Q.](bui
|
||||||
- [Set Unreal Engine environment variable](#set-unreal-engine-environment-variable)
|
- [Set Unreal Engine environment variable](#set-unreal-engine-environment-variable)
|
||||||
- [Build CARLA](#build-carla)
|
- [Build CARLA](#build-carla)
|
||||||
- [Other make commands](#other-make-commands)
|
- [Other make commands](#other-make-commands)
|
||||||
- [__Summary__](#summary)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
## Part One: Prerequisites
|
## Part One: Prerequisites
|
||||||
|
@ -46,23 +45,18 @@ sudo apt-get update
|
||||||
The following commands depend on your Ubuntu version. Make sure to choose accordingly.
|
The following commands depend on your Ubuntu version. Make sure to choose accordingly.
|
||||||
|
|
||||||
__Ubuntu 18.04__.
|
__Ubuntu 18.04__.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git &&
|
sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git
|
||||||
pip2 install --user setuptools &&
|
|
||||||
pip3 install --user -Iv setuptools==47.3.1 &&
|
|
||||||
pip2 install --user distro &&
|
|
||||||
pip3 install --user distro
|
|
||||||
```
|
```
|
||||||
__Previous Ubuntu__ versions.
|
__Previous Ubuntu__ versions.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git &&
|
sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git
|
||||||
pip2 install --user setuptools &&
|
|
||||||
pip3 install --user -Iv setuptools==47.3.1 &&
|
|
||||||
pip2 install --user distro &&
|
|
||||||
pip3 install --user distro
|
|
||||||
```
|
```
|
||||||
|
|
||||||
__All Ubuntu systems__.
|
__All Ubuntu systems__.
|
||||||
|
|
||||||
To avoid compatibility issues between Unreal Engine and the CARLA dependencies, use the same compiler version and C++ runtime library to compile everything. The CARLA team uses clang-8 and LLVM's libc++. Change the default clang version to compile Unreal Engine and the CARLA dependencies.
|
To avoid compatibility issues between Unreal Engine and the CARLA dependencies, use the same compiler version and C++ runtime library to compile everything. The CARLA team uses clang-8 and LLVM's libc++. Change the default clang version to compile Unreal Engine and the CARLA dependencies.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -70,6 +64,37 @@ sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-8/bin/
|
||||||
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-8/bin/clang 180
|
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-8/bin/clang 180
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Starting with CARLA 0.9.12, users have the option to install the CARLA Python API using `pip` or `pip3`. Version 20.3 or higher is required. To check if you have a suitable version, run the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# For Python 3
|
||||||
|
pip3 -V
|
||||||
|
|
||||||
|
# For Python 2
|
||||||
|
pip -V
|
||||||
|
```
|
||||||
|
|
||||||
|
If you need to upgrade:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# For Python 3
|
||||||
|
pip3 install --upgrade pip
|
||||||
|
|
||||||
|
# For Python 2
|
||||||
|
pip install --upgrade pip
|
||||||
|
```
|
||||||
|
|
||||||
|
You must install the following Python dependencies:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pip install --user setuptools &&
|
||||||
|
pip3 install --user -Iv setuptools==47.3.1 &&
|
||||||
|
pip install --user distro &&
|
||||||
|
pip3 install --user distro &&
|
||||||
|
pip install --user wheel &&
|
||||||
|
pip3 install --user wheel auditwheel
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Unreal Engine
|
## Unreal Engine
|
||||||
|
@ -195,14 +220,38 @@ The following command compiles the Python API client:
|
||||||
make PythonAPI
|
make PythonAPI
|
||||||
```
|
```
|
||||||
|
|
||||||
Optionally, to compile the PythonAPI for Python 2, run the following command in the root CARLA directory.
|
Optionally, to compile the PythonAPI for a specific version of Python, run the below command in the root CARLA directory.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make PythonAPI ARGS="--python-version=2"
|
# Delete versions as required
|
||||||
|
make PythonAPI ARGS="--python-version=2.7, 3.6, 3.7, 3.8"
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! Note
|
The CARLA client library will be built in two distinct, mutually exclusive forms. This gives users the freedom to choose which form they prefer to run the CARLA client code. The two forms include `.egg` files and `.whl` files. Choose __one__ of the following options below to use the client library:
|
||||||
__Note that when the compilation is done, you may see a successful output in the terminal even if the compilation of the Python API client was unsuccessful.__ Check for any errors in the terminal output and check that a `.egg` file exists in `PythonAPI\carla\dist`. If you come across any errors, check the [F.A.Q.](build_faq.md) or post in the [CARLA forum](https://github.com/carla-simulator/carla/discussions).
|
|
||||||
|
__A. `.egg` file__
|
||||||
|
|
||||||
|
>The `.egg` file does not need to be installed. All of CARLA's example scripts automatically [look for this file](build_system.md#versions-prior-to-0912) when importing CARLA.
|
||||||
|
|
||||||
|
>If you previously installed a CARLA `.whl`, the `.whl` will take precedence over an `.egg` file.
|
||||||
|
|
||||||
|
__B. `.whl` file__
|
||||||
|
|
||||||
|
>The `.whl` file should be installed using `pip` or `pip3`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Python 3
|
||||||
|
pip3 install <path/to/wheel>.whl
|
||||||
|
|
||||||
|
# Python 2
|
||||||
|
pip install <path/to/wheel>.whl
|
||||||
|
```
|
||||||
|
|
||||||
|
>This `.whl` file cannot be distributed as it is built specifically for your OS.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
Issues can arise through the use of different methods to install the CARLA client library and having different versions of CARLA on your system. It is recommended to use virtual environments when installing the `.whl` and to [uninstall](build_faq.md#how-do-i-uninstall-the-carla-client-library) any previously installed client libraries before installing new ones.
|
||||||
|
|
||||||
|
|
||||||
__2.__ __Compile the server__:
|
__2.__ __Compile the server__:
|
||||||
|
|
||||||
|
@ -232,10 +281,6 @@ Test the simulator using the example scripts inside `PythonAPI\examples`. With
|
||||||
python3 dynamic_weather.py
|
python3 dynamic_weather.py
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! Note
|
|
||||||
If you encounter the error `ModuleNotFoundError: No module named 'carla'` while running a script, you may be running a different version of Python than the one used to install the client. Go to `PythonAPI\carla\dist` and check the version of Python used in the `.egg` file.
|
|
||||||
|
|
||||||
|
|
||||||
!!! Important
|
!!! Important
|
||||||
If the simulation is running at a very low FPS rate, go to `Edit -> Editor preferences -> Performance` in the Unreal Engine editor and disable `Use less CPU when in background`.
|
If the simulation is running at a very low FPS rate, go to `Edit -> Editor preferences -> Performance` in the Unreal Engine editor and disable `Use less CPU when in background`.
|
||||||
|
|
||||||
|
@ -255,83 +300,6 @@ There are more `make` commands that you may find useful. Find them in the table
|
||||||
| `make clean` | Deletes all the binaries and temporals generated by the build system. |
|
| `make clean` | Deletes all the binaries and temporals generated by the build system. |
|
||||||
| `make rebuild` | `make clean` and `make launch` both in one command. |
|
| `make rebuild` | `make clean` and `make launch` both in one command. |
|
||||||
|
|
||||||
---
|
|
||||||
## Summary
|
|
||||||
|
|
||||||
Below is a summary of the requirements and commands needed to build CARLA on Linux:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# Make sure to meet the minimum requirements
|
|
||||||
# Read the complete documentation to understand each step
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
sudo apt-get update &&
|
|
||||||
sudo apt-get install wget software-properties-common &&
|
|
||||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&
|
|
||||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - &&
|
|
||||||
sudo apt-add-repository "deb http://apt.llvm.org/$(lsb_release -c --short)/ llvm-toolchain-$(lsb_release -c --short)-8 main" &&
|
|
||||||
sudo apt-get update
|
|
||||||
|
|
||||||
# Additional dependencies for Ubuntu 18.04
|
|
||||||
sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git &&
|
|
||||||
pip2 install --user setuptools &&
|
|
||||||
pip3 install --user -Iv setuptools==47.3.1
|
|
||||||
|
|
||||||
# Additional dependencies for previous Ubuntu versions
|
|
||||||
sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev git &&
|
|
||||||
pip2 install --user setuptools &&
|
|
||||||
pip3 install --user -Iv setuptools==47.3.1 &&
|
|
||||||
pip2 install --user distro &&
|
|
||||||
pip3 install --user distro
|
|
||||||
|
|
||||||
# Change default clang version
|
|
||||||
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-8/bin/clang++ 180 &&
|
|
||||||
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-8/bin/clang 180
|
|
||||||
|
|
||||||
# Get a GitHub and an Unreal Engine account, and link both
|
|
||||||
|
|
||||||
# Download Unreal Engine 4.24
|
|
||||||
git clone --depth 1 -b carla https://github.com/CarlaUnreal/UnrealEngine.git ~/UnrealEngine_4.26
|
|
||||||
cd ~/UnrealEngine_4.26
|
|
||||||
|
|
||||||
# Build Unreal Engine
|
|
||||||
./Setup.sh && ./GenerateProjectFiles.sh && make
|
|
||||||
|
|
||||||
# Open the Unreal Engine Editor to check everything works properly
|
|
||||||
cd ~/UnrealEngine_4.26/Engine/Binaries/Linux && ./UE4Editor
|
|
||||||
|
|
||||||
# Clone the CARLA repository
|
|
||||||
git clone https://github.com/carla-simulator/carla
|
|
||||||
|
|
||||||
# Get the CARLA assets
|
|
||||||
cd ~/carla
|
|
||||||
./Update.sh
|
|
||||||
|
|
||||||
# Set the environment variable
|
|
||||||
export UE4_ROOT=~/UnrealEngine_4.26
|
|
||||||
|
|
||||||
# make the CARLA client
|
|
||||||
make PythonAPI
|
|
||||||
|
|
||||||
# make the CARLA server
|
|
||||||
make launch
|
|
||||||
|
|
||||||
# Press play in the Editor to initialize the server
|
|
||||||
# Run example scripts to test CARLA
|
|
||||||
# Terminal A
|
|
||||||
cd PythonAPI/examples
|
|
||||||
python3 -m pip install -r requirements.txt
|
|
||||||
python3 generate_traffic.py
|
|
||||||
# Terminal B
|
|
||||||
cd PythonAPI/examples
|
|
||||||
python3 generate_traffic.py
|
|
||||||
python3 dynamic_weather.py
|
|
||||||
|
|
||||||
# Optionally, to compile the PythonAPI for Python2
|
|
||||||
make PythonAPI ARGS="--python-version=2"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Read the **[F.A.Q.](build_faq.md)** page or post in the [CARLA forum](https://github.com/carla-simulator/carla/discussions) for any issues regarding this guide.
|
Read the **[F.A.Q.](build_faq.md)** page or post in the [CARLA forum](https://github.com/carla-simulator/carla/discussions) for any issues regarding this guide.
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
* [__LibCarla__](#libcarla)
|
* [__LibCarla__](#libcarla)
|
||||||
* [__CarlaUE4 and Carla plugin__](#carlaue4-and-carla-plugin)
|
* [__CarlaUE4 and Carla plugin__](#carlaue4-and-carla-plugin)
|
||||||
* [__PythonAPI__](#pythonapi)
|
* [__PythonAPI__](#pythonapi)
|
||||||
|
- [Versions 0.9.12+](#versions-0912)
|
||||||
|
- [Versions prior to 0.9.12](#versions-prior-to-0912)
|
||||||
|
|
||||||
> _This document is a work in progress, only the Linux build system is taken into account here._
|
> _This document is a work in progress, only the Linux build system is taken into account here._
|
||||||
|
|
||||||
|
@ -74,9 +76,36 @@ make launch
|
||||||
|
|
||||||
---
|
---
|
||||||
## PythonAPI
|
## PythonAPI
|
||||||
|
### Versions 0.9.12+
|
||||||
|
|
||||||
Compiled using Python's `setuptools` ("setup.py"). Currently requires the following to be installed in the machine: Python, libpython-dev, and
|
Compiled using Python's `setuptools` ("setup.py"). Currently requires the following to be installed in the machine: Python, libpython-dev, and
|
||||||
libboost-python-dev; both for Python 2.7 and 3.5.
|
libboost-python-dev, pip>=20.3, wheel, and auditwheel.
|
||||||
|
|
||||||
|
Command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make PythonAPI
|
||||||
|
```
|
||||||
|
|
||||||
|
Creates two files that each contain the client library and correspond to the supported Python version on the system. One file is a `.whl` file and the other is an `.egg` file. This allows for the option of two different, mutually exclusive ways to use the client library.
|
||||||
|
|
||||||
|
>__A. .whl file__
|
||||||
|
|
||||||
|
>>The `.whl` is installed using the command:
|
||||||
|
|
||||||
|
>> pip install <wheel_file>.whl
|
||||||
|
|
||||||
|
>>There is no need to import the library path directly in scripts as is required in previous versions or `.egg` files (see section [__Versions prior to 0.9.12__](#versions-prior-to-0912)); `import carla` is sufficient.
|
||||||
|
|
||||||
|
>__B. .egg file__
|
||||||
|
|
||||||
|
>>See the section [__Versions prior to 0.9.12__](#versions-prior-to-0912) for more information.
|
||||||
|
|
||||||
|
|
||||||
|
### Versions prior to 0.9.12
|
||||||
|
|
||||||
|
Compiled using Python's `setuptools` ("setup.py"). Currently requires the following to be installed in the machine: Python, libpython-dev, and
|
||||||
|
libboost-python-dev.
|
||||||
|
|
||||||
Command
|
Command
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ If you come across errors or difficulties then have a look at the **[F.A.Q.](bui
|
||||||
- [Set Unreal Engine environment variable](#set-unreal-engine-environment-variable)
|
- [Set Unreal Engine environment variable](#set-unreal-engine-environment-variable)
|
||||||
- [Build CARLA](#build-carla)
|
- [Build CARLA](#build-carla)
|
||||||
- [Other make commands](#other-make-commands)
|
- [Other make commands](#other-make-commands)
|
||||||
- [__Summary__](#summary)
|
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -48,9 +47,24 @@ In this section you will find details of system requirements, minor and major so
|
||||||
Be sure that the above programs are added to the [environment path](https://www.java.com/en/download/help/path.xml). Remember that the path added should correspond to the progam's `bin` directory.
|
Be sure that the above programs are added to the [environment path](https://www.java.com/en/download/help/path.xml). Remember that the path added should correspond to the progam's `bin` directory.
|
||||||
#### Python dependencies
|
#### Python dependencies
|
||||||
|
|
||||||
Run the following command to install the dependencies for the Python API client:
|
Starting with CARLA 0.9.12, users have the option to install the CARLA Python API using `pip3`. Version 20.3 or higher is required. To check if you have a suitable version, run the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pip3 -V
|
||||||
|
```
|
||||||
|
|
||||||
|
If you need to upgrade:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pip3 install --upgrade pip
|
||||||
|
```
|
||||||
|
|
||||||
|
You must install the following Python dependencies:
|
||||||
|
|
||||||
|
```sh
|
||||||
pip3 install --user setuptools
|
pip3 install --user setuptools
|
||||||
|
pip3 install --user wheel
|
||||||
|
```
|
||||||
|
|
||||||
#### Major installations
|
#### Major installations
|
||||||
##### Visual Studio 2019
|
##### Visual Studio 2019
|
||||||
|
@ -176,15 +190,26 @@ The following command compiles the Python API client:
|
||||||
make PythonAPI
|
make PythonAPI
|
||||||
```
|
```
|
||||||
|
|
||||||
Optionally, to compile the PythonAPI for Python2, run the following command in the root CARLA directory.
|
The CARLA client library will be built in two distinct, mutually exclusive forms. This gives users the freedom to choose which form they prefer to run the CARLA client code. The two forms include `.egg` files and `.whl` files. Choose __one__ of the following options below to use the client library:
|
||||||
|
|
||||||
|
__A. `.egg` file__
|
||||||
|
|
||||||
|
>The `.egg` file does not need to be installed. All of CARLA's example scripts automatically [look for this file](build_system.md#versions-prior-to-0912) when importing CARLA.
|
||||||
|
|
||||||
|
>If you previously installed a CARLA `.whl`, the `.whl` will take precedence over an `.egg` file.
|
||||||
|
|
||||||
|
__B. `.whl` file__
|
||||||
|
|
||||||
|
>The `.whl` file should be installed using `pip3`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make PythonAPI ARGS="--python-version=2"
|
pip3 install <path/to/wheel>.whl
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! Note
|
>This `.whl` file cannot be distributed as it is built specifically for your OS.
|
||||||
__Note that when the compilation is done, you may see a successful output in the terminal even if the compilation of the Python API client was unsuccessful.__ Check for any errors in the terminal output and check that a `.egg` file exists in `PythonAPI\carla\dist`. If you come across any errors, check the [F.A.Q.](build_faq.md) or post in the [CARLA forum](https://github.com/carla-simulator/carla/discussions).
|
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
Issues can arise through the use of different methods to install the CARLA client library and having different versions of CARLA on your system. It is recommended to use virtual environments when installing the `.whl` and to [uninstall](build_faq.md#how-do-i-uninstall-the-carla-client-library) any previously installed client libraries before installing new ones.
|
||||||
|
|
||||||
__2.__ __Compile the server__:
|
__2.__ __Compile the server__:
|
||||||
|
|
||||||
|
@ -205,7 +230,7 @@ Test the simulator using the example scripts inside `PythonAPI\examples`. With
|
||||||
```sh
|
```sh
|
||||||
# Terminal A
|
# Terminal A
|
||||||
cd PythonAPI\examples
|
cd PythonAPI\examples
|
||||||
pip install -r requirements.txt
|
pip3 install -r requirements.txt
|
||||||
python3 generate_traffic.py
|
python3 generate_traffic.py
|
||||||
|
|
||||||
# Terminal B
|
# Terminal B
|
||||||
|
@ -213,10 +238,6 @@ Test the simulator using the example scripts inside `PythonAPI\examples`. With
|
||||||
python3 dynamic_weather.py
|
python3 dynamic_weather.py
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! Note
|
|
||||||
If you encounter the error `ModuleNotFoundError: No module named 'carla'` while running a script, you may be running a different version of Python than the one used to install the client. Go to `PythonAPI\carla\dist` and check the version of Python used in the `.egg` file.
|
|
||||||
|
|
||||||
|
|
||||||
!!! Important
|
!!! Important
|
||||||
If the simulation is running at a very low FPS rate, go to `Edit -> Editor preferences -> Performance` in the Unreal Engine editor and disable `Use less CPU when in background`.
|
If the simulation is running at a very low FPS rate, go to `Edit -> Editor preferences -> Performance` in the Unreal Engine editor and disable `Use less CPU when in background`.
|
||||||
|
|
||||||
|
@ -234,51 +255,6 @@ There are more `make` commands that you may find useful. Find them in the table
|
||||||
| `make clean` | Deletes all the binaries and temporals generated by the build system. |
|
| `make clean` | Deletes all the binaries and temporals generated by the build system. |
|
||||||
| `make rebuild` | `make clean` and `make launch` both in one command. |
|
| `make rebuild` | `make clean` and `make launch` both in one command. |
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Summary
|
|
||||||
|
|
||||||
Below is a summary of the requirements and commands needed to build CARLA on Windows:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# Make sure to meet the minimum requirements:
|
|
||||||
#
|
|
||||||
# x64 system
|
|
||||||
# 165 GB disk space
|
|
||||||
# 6 - 8 GB GPU
|
|
||||||
# Two TCP ports and good internet connection
|
|
||||||
|
|
||||||
# Necessary software:
|
|
||||||
# CMake
|
|
||||||
# Git
|
|
||||||
# Make
|
|
||||||
# Python3 x64
|
|
||||||
# Modified Unreal Engine 4.24
|
|
||||||
# Visual Studio 2019 with Windows 8.1 SDK, x64 Visual C++ Toolset and .NET framework 4.6.2
|
|
||||||
|
|
||||||
# Set environment variables for the software
|
|
||||||
|
|
||||||
# Clone the CARLA repository
|
|
||||||
git clone https://github.com/carla-simulator/carla
|
|
||||||
|
|
||||||
# Get assets
|
|
||||||
# Set UE4_ROOT environment variable
|
|
||||||
|
|
||||||
# make the CARLA client and the CARLA server
|
|
||||||
# open the x64 Native Tools Command Prompt for VS 2019 to execute the following commands
|
|
||||||
make PythonAPI
|
|
||||||
make launch
|
|
||||||
|
|
||||||
# Press play in the Editor to initialize the server
|
|
||||||
# Run example scripts to test CARLA
|
|
||||||
# Terminal A
|
|
||||||
cd PythonAPI\examples
|
|
||||||
pip install -r requirements.txt
|
|
||||||
python3 generate_traffic.py
|
|
||||||
# Terminal B
|
|
||||||
cd PythonAPI\examples
|
|
||||||
python3 dynamic_weather.py
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -299,6 +275,3 @@ First steps</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,60 @@
|
||||||
# Quick start package installation
|
# Quick start package installation
|
||||||
|
|
||||||
This guide shows how to download and install the packaged version of CARLA. The package includes the CARLA server and the Python API client library ready to run out of the box and does not require any build process. There are additional assets that can be downloaded and imported into the package. Advanced customization and development options that require use of the Unreal Engine editor are not available but these can be accessed by using the build version of CARLA for either [Windows](build_windows.md) or [Linux](build_linux.md).
|
This guide shows how to download and install the packaged version of CARLA. The package includes the CARLA server and two options for the client library. There are additional assets that can be downloaded and imported into the package. Advanced customization and development options that require use of the Unreal Engine editor are not available but these can be accessed by using the build version of CARLA for either [Windows](build_windows.md) or [Linux](build_linux.md).
|
||||||
|
|
||||||
* __[Before you begin](#before-you-begin)__
|
* __[Before you begin](#before-you-begin)__
|
||||||
* __[CARLA installation](#carla-installation)__
|
* __[CARLA installation](#carla-installation)__
|
||||||
* [A. Debian CARLA installation](#a-debian-carla-installation)
|
* [A. Debian CARLA installation](#a-debian-carla-installation)
|
||||||
* [B. Package installation](#b-package-installation)
|
* [B. Package installation](#b-package-installation)
|
||||||
* __[Import additional assets](#import-additional-assets)__
|
* __[Import additional assets](#import-additional-assets)__
|
||||||
|
* __[Install client library](#install-client-library)__
|
||||||
|
* [CARLA versions prior to 0.9.12](#carla-versions-prior-to-0912)
|
||||||
|
* [CARLA 0.9.12+](#carla-0912)
|
||||||
* __[Running CARLA](#running-carla)__
|
* __[Running CARLA](#running-carla)__
|
||||||
* [Command-line options](#command-line-options)
|
* [Command-line options](#command-line-options)
|
||||||
* __[Updating CARLA](#updating-carla)__
|
* __[Updating CARLA](#updating-carla)__
|
||||||
* __[Installation summary](#installation-summary)__
|
|
||||||
* __[Follow-up](#follow-up)__
|
* __[Follow-up](#follow-up)__
|
||||||
---
|
---
|
||||||
## Before you begin
|
## Before you begin
|
||||||
|
|
||||||
The following requirements should be fulfilled before installing CARLA:
|
The following requirements should be fulfilled before installing CARLA:
|
||||||
|
|
||||||
* __System requirements.__ Any 64-bits OS should run CARLA.
|
* __System requirements.__ CARLA is built for Windows and Linux systems.
|
||||||
* __An adequate GPU.__ CARLA aims for realistic simulations, so the server needs at least a 6 GB GPU although we would recommend 8 GB. A dedicated GPU is highly recommended for machine learning.
|
* __An adequate GPU.__ CARLA aims for realistic simulations, so the server needs at least a 6 GB GPU although we would recommend 8 GB. A dedicated GPU is highly recommended for machine learning.
|
||||||
* __Disk space.__ CARLA will use about 20 GB of space.
|
* __Disk space.__ CARLA will use about 20 GB of space.
|
||||||
* __Python.__ [Python]((https://www.python.org/downloads/)) is the main scripting language in CARLA. CARLA supports both Python 2 and Python 3.7.
|
* __Python.__ [Python]((https://www.python.org/downloads/)) is the main scripting language in CARLA. CARLA supports Python 2.7 and Python 3 on Linux, and Python 3 on Windows.
|
||||||
|
* __Pip.__ Some installation methods of the CARLA client library require __pip__ or __pip3__ (depending on your Python version) version 20.3 or higher. To check your __pip__ version:
|
||||||
|
|
||||||
|
>> # For Python 3
|
||||||
|
>> pip3 -V
|
||||||
|
|
||||||
|
>> # For Python 2
|
||||||
|
>> pip -V
|
||||||
|
|
||||||
|
>If you need to upgrade:
|
||||||
|
|
||||||
|
>> # For Python 3
|
||||||
|
>> pip3 install --upgrade pip
|
||||||
|
|
||||||
|
>> # For Python 2
|
||||||
|
>> pip install --upgrade pip
|
||||||
|
|
||||||
* __Two TCP ports and good internet connection.__ 2000 and 2001 by default. Make sure that these ports are not blocked by firewalls or any other applications.
|
* __Two TCP ports and good internet connection.__ 2000 and 2001 by default. Make sure that these ports are not blocked by firewalls or any other applications.
|
||||||
* __Other requirements.__ Two Python modules: [Pygame](https://pypi.org/project/pygame/) to create graphics directly with Python, and [Numpy](https://pypi.org/project/numpy/) for calculus. Install them using:
|
* __Other requirements.__ CARLA requires some Python dependencies. Install the dependencies according to your operating system:
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python3 -m pip install --user pygame numpy # Support for Python2 is provided in the CARLA release packages
|
pip3 install --user pygame numpy
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Linux
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pip install --user pygame numpy &&
|
||||||
|
pip3 install --user pygame numpy
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
## CARLA installation
|
## CARLA installation
|
||||||
|
|
||||||
|
@ -98,6 +126,62 @@ __2.__ Extract the package:
|
||||||
|
|
||||||
- Extract the contents directly in the root folder.
|
- Extract the contents directly in the root folder.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Install client library
|
||||||
|
|
||||||
|
### CARLA versions prior to 0.9.12
|
||||||
|
|
||||||
|
Previous versions of CARLA did not require the Python library to be installed, they came with an `.egg` file that was ready to use out of the box. __CARLA versions 0.9.12+ change this behavior significantly; there are several options available to install the client library.__ If you are using a version of CARLA prior to 0.9.12, please select that version in the bottom right corner of the screen to see the relevant documentation. Otherwise, read on below about the available options in CARLA 0.9.12+.
|
||||||
|
|
||||||
|
### CARLA 0.9.12+
|
||||||
|
|
||||||
|
There are several options available to install and use the CARLA client library:
|
||||||
|
|
||||||
|
- __.egg__ file
|
||||||
|
- __.whl__ file
|
||||||
|
- __Downloadable Python package__
|
||||||
|
|
||||||
|
Read more below about the requirements and limitations of each method before deciding which one to use. Please note that mixing the different methods can lead to incompatibilities, so use virtual environments when possible or [uninstall](build_faq.md#how-do-i-uninstall-the-carla-client-library) a previously installed library before using a new one.
|
||||||
|
|
||||||
|
>__A. .egg files__
|
||||||
|
|
||||||
|
>>CARLA provides `.egg` files in `PythonAPI/carla/dist/` for different Python versions that are ready to use out of the box. Each of the example scripts in `PythonAPI/examples` includes a [code snippet](build_system.md#versions-prior-to-0912) that looks for this file automatically. In Linux, you may need to add this file to your `PYTHONPATH`. Read more about `.egg` files in CARLA [here](build_faq.md#importerror-no-module-named-carla).
|
||||||
|
|
||||||
|
>>__If you have previously installed the client library with `pip`, this will take precedence over the `.egg` file__. You will need to [uninstall](build_faq.md#how-do-i-uninstall-the-carla-client-library) the previous library first.
|
||||||
|
|
||||||
|
>__B. .whl files__
|
||||||
|
|
||||||
|
>>CARLA provides `.whl` files for different Python versions. You will need to install the `.whl` file. The `.whl` file is found in `PythonAPI/carla/dist/`. There is one file per supported Python version, indicated by the file name (e.g., carla-0.9.12-__cp36__-cp36m-manylinux_2_27_x86_64.whl indicates Python 3.6).
|
||||||
|
|
||||||
|
>>__It is recommended to install the CARLA client library in a virtual environment to avoid conflicts when working with multiple versions.__
|
||||||
|
|
||||||
|
>>To install the CARLA client library, run the following command, choosing the file appropriate to your desired Python version. You will need __pip/pip3__ version 20.3 or above. See the [__Before you begin__](#before-you-begin) section for how to check the version and upgrade __pip/pip3__:
|
||||||
|
|
||||||
|
>> # Python 3
|
||||||
|
>> pip3 install <wheel-file-name>.whl
|
||||||
|
|
||||||
|
>> # Python 2
|
||||||
|
>> pip install <wheel-file-name>.whl
|
||||||
|
|
||||||
|
>>If you previously installed the client library, you should [uninstall](build_faq.md#how-do-i-uninstall-the-carla-client-library) the old one before installing the new one.
|
||||||
|
|
||||||
|
>__C. Downloadable Python package__
|
||||||
|
|
||||||
|
>>The CARLA client library can be downloaded from [PyPi](https://pypi.org/project/carla/). This library is compatible with Python versions 2.7, 3.6, 3.7, and 3.8. To install it you will need __pip/pip3__ version 20.3 or above. See the [__Before you begin__](#before-you-begin) section for how to check the version and upgrade __pip/pip3__.
|
||||||
|
|
||||||
|
>>__It is recommended to install the CARLA client library in a virtual environment to avoid conflicts when working with multiple versions.__
|
||||||
|
|
||||||
|
>>To install the client library from PyPi, run the following command:
|
||||||
|
|
||||||
|
>> # Python 3
|
||||||
|
>> pip3 install carla
|
||||||
|
|
||||||
|
>> # Python 2
|
||||||
|
>> pip install carla
|
||||||
|
|
||||||
|
>>The PyPi download is suitable for use with CARLA packages only (i.e., not with a version built from source). Since the PyPi download __only contains the client library__, it is most useful in situations where you will be communicating with a remote CARLA server where you do not require downloading a full CARLA package.
|
||||||
|
|
||||||
---
|
---
|
||||||
## Running CARLA
|
## Running CARLA
|
||||||
|
|
||||||
|
@ -177,41 +261,14 @@ The script [`PythonAPI/util/config.py`][config] provides more configuration opti
|
||||||
|
|
||||||
There is no way to update the packaged version of CARLA. When a new version is released, the repository is updated and you will need to delete the previous version and install the new version.
|
There is no way to update the packaged version of CARLA. When a new version is released, the repository is updated and you will need to delete the previous version and install the new version.
|
||||||
|
|
||||||
---
|
If you installed the client library using __pip/pip3__, you should uninstall it by running:
|
||||||
|
|
||||||
## Installation summary
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Install required modules Pygame and Numpy
|
# Python 3
|
||||||
python3 -m pip install --user pygame numpy # Support for Python 2 is provided in the CARLA release packages
|
pip3 uninstall carla
|
||||||
|
|
||||||
# There are two different ways to install CARLA
|
|
||||||
|
|
||||||
# Option A) Debian package installation
|
|
||||||
# This repository contains CARLA 0.9.10 and later. To install previous CARLA versions, change to a previous version of the docs using the panel in the bottom right part of the window
|
|
||||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1AF1527DE64CB8D9
|
|
||||||
sudo add-apt-repository "deb [arch=amd64] http://dist.carla.org/carla $(lsb_release -sc) main"
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install carla-simulator # Install the latest CARLA version or update the current installation
|
|
||||||
sudo apt-get install carla-simulator=0.9.10-1 # install a specific CARLA version
|
|
||||||
cd /opt/carla-simulator
|
|
||||||
./CarlaUE4.sh
|
|
||||||
|
|
||||||
# Option B) Package installation
|
|
||||||
# Go to: https://github.com/carla-simulator/carla/blob/master/Docs/download.md
|
|
||||||
# Download the desired package and additional assets
|
|
||||||
# Extract the package
|
|
||||||
# Extract the additional assets in `/Import`
|
|
||||||
# Run CARLA (Linux).
|
|
||||||
./CarlaUE.sh
|
|
||||||
# Run CARLA (Windows)
|
|
||||||
CarlaUE4.exe
|
|
||||||
|
|
||||||
# Run a script to test CARLA.
|
|
||||||
cd PythonAPI/examples
|
|
||||||
python3 -m pip install -r requirements.txt
|
|
||||||
python3 generate_traffic.py # Support for Python 2 is provided in the CARLA release packages
|
|
||||||
|
|
||||||
|
# Python 2
|
||||||
|
pip uninstall carla
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
@ -840,7 +840,6 @@ Hereunder are the two scripts gathering the fragments of code for this tutorial.
|
||||||
<summary><b>tutorial_ego.py</b> </summary>
|
<summary><b>tutorial_ego.py</b> </summary>
|
||||||
|
|
||||||
```py
|
```py
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -1076,7 +1075,6 @@ if __name__ == '__main__':
|
||||||
<summary><b>tutorial_replay.py</b></summary>
|
<summary><b>tutorial_replay.py</b></summary>
|
||||||
|
|
||||||
```py
|
```py
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
Loading…
Reference in New Issue