Development environment
Setup the dependencies:
-
Install necessary dependencies:
Ubuntu 18.04
sudo apt-get update && sudo apt-get --no-install-recommends install -y build-essential curl git redis-server python3-dev python3-pip python3-venv python3-tk libldap2-dev libsasl2-dev pkg-config libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libswscale-dev libswresample-dev libavfilter-dev
# Install Node.js 16 and yarn curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - sudo apt-get install -y nodejs sudo npm install --global yarn
MacOS 10.15
brew install git python pyenv redis curl openssl node sqlite3 geos
Arch Linux
# Update the system and AUR (you can use any other AUR helper of choice) first: sudo pacman -Syyu pikaur -Syu
# Install the required dependencies: sudo pacman -S base-devel curl git redis cmake gcc python python-pip tk libldap libsasl pkgconf ffmpeg geos openldap python-lda
# CVAT supports only Python 3.9, so install it if you don’t have it: pikaur -S python39
# Install Node.js 16, yarn and npm sudo pacman -S nodejs-lts-gallium yarn npm
-
Install Chrome
-
Install FFmpeg libraries (libav*) version 4.0 or higher.
-
Install VS Code.
-
Install the following VScode extensions:
-
Make sure to use Python 3.9.0 or higher
python3 --version
-
Install CVAT on your local host:
git clone https://github.com/cvat-ai/cvat cd cvat && mkdir logs keys python3 -m venv .env . .env/bin/activate pip install -U pip wheel setuptools pip install -r cvat/requirements/development.txt -r utils/dataset_manifest/requirements.txt python manage.py migrate python manage.py collectstatic
Note for Mac users
If you have any problems with installing dependencies from
cvat/requirements/*.txt
, you may need to reinstall your system python In some cases after system update it can be configured incorrectly and cannot compile some native modulesMake sure Homebrew lib path is in
DYLD_LIBRARY_PATH
. For Apple Silicon:export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
Homebrew will install FFMpeg 5.0 by default, which does not work, so you should install 4.X. You can install older 4.X FFMpeg using Homebrew like that:
cd "$(brew --repo homebrew/core)" git checkout addd616edc9134f057e33694c420f4900be59db8 brew unlink ffmpeg HOMEBREW_NO_AUTO_UPDATE=1 brew install ffmpeg git checkout master
if you are still facing error
Running setup.py install for av ... error
, you may try more radical variantcd "$(brew --repo homebrew/core)" git checkout addd616edc9134f057e33694c420f4900be59db8 brew uninstall ffmpeg --force HOMEBREW_NO_AUTO_UPDATE=1 brew install ffmpeg git checkout master
If you faced with error
Failed building wheel for h5py
, you may need installhdf5
brew install hdf5 export HDF5_DIR="$(brew --prefix hdf5)" pip install --no-binary=h5py h5py
If you faced with error
OSError: Could not find library geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so']
. You may fix this usingsudo ln -s /opt/homebrew/lib/libgeos_c.dylib /usr/local/lib
On Mac with Apple Silicon (M1) in order to install TensorFlow you will have to edit
cvat/requirements/base.txt
. Changetensorflow
totensorflow-macos
May need to downgrade version Python to 3.9.* or upgrade versiontensorflow-macos
Note for Arch Linux users:
In order to build
python-ldap
, thegcc
compiler needs to be pointed to the right file, since lib name has been changed fromlibldap_r
tolibldap
, otherwise wheels forpython-ldap
won’t be built and the install will fail. You need to create a symlink between the newer and olderldap
libraries:sudo ln -s /usr/lib/libldap.so /usr/lib/libldap_r.so
Because PyAV as of version 10.0.0 already works with FFMPEG5, you may consider changing the
av
version requirement in/cvat/cvat/requirements/base.txt
to 10.0.0 or higher.Perform these actions before installing cvat requirements from the list mentioned above.
-
Create a super user for CVAT:
python manage.py createsuperuser
-
Install npm packages for UI (run the following command from CVAT root directory):
yarn --frozen-lockfile
Note for Mac users
If you faced with error
Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (57)
Read this article Node Sass does not yet support your current environment
-
Install Docker Engine and Docker-Compose
-
Pull and run OpenPolicyAgent Docker image:
docker run -d --rm --name cvat_opa_debug -p 8181:8181 openpolicyagent/opa:0.34.2-rootless \ run --server --set=decision_logs.console=true --set=services.cvat.url=http://host.docker.internal:7000 \ --set=bundles.cvat.service=cvat --set=bundles.cvat.resource=/api/auth/rules
Run CVAT
-
Start npm UI debug server (run the following command from CVAT root directory):
- If you want to run CVAT in localhost:
yarn run start:cvat-ui
- If you want to access CVAT from outside of your host:
CVAT_UI_HOST='<YOUR_HOST_IP>' yarn run start:cvat-ui
- If you want to run CVAT in localhost:
-
Open a new terminal window.
-
Run VScode from the virtual environment (run the following command from CVAT root directory):
source .env/bin/activate && code
-
Inside VScode, Open CVAT root dir
-
Select
server: debug
configuration and run it (F5) to run REST server and its workers -
Make sure that
Uncaught Exceptions
option under breakpoints section is unchecked -
If you choose to run CVAT in localhost: Select
server: chrome
configuration and run it (F5) to open CVAT in Chrome -
Alternative: If you changed CVAT_UI_HOST just enter
<YOUR_HOST_IP>:3000
in your browser.
You have done! Now it is possible to insert breakpoints and debug server and client of the tool. Instructions for running tests locally are available here.
Note for Windows users
You develop CVAT under WSL (Windows subsystem for Linux) following next steps.
-
Install WSL using this guide.
-
Following this guide install Ubuntu 18.04 Linux distribution for WSL.
-
Run Ubuntu using start menu link or execute next command
wsl -d Ubuntu-18.04
-
Run all commands from this installation guide in WSL Ubuntu shell.
-
You might have to manually start the redis server in wsl before you can start the configuration inside Visual Studio Code. You can do this with
sudo service redis-server start
. Alternatively you can also use a redis docker image instead of using the redis-server locally.
Note for Mac users
- You might have to manually start the redis server. You can do this with
redis-server
. Alternatively you can also use a redis docker image instead of using the redis-server locally.
Note for Arch Linux users
- You need to start
redis
anddocker
services manually in order to begin debugging/running tests:sudo systemctl start redis.service sudo systemctl start docker.service