# INSTALLATION

Duplicity requires several system and Python dependencies. Choose one of the following methods to install them.

## (1) Pipx Installation (Recommended)

This method is recommended for most users. It uses `pipx` to install duplicity into an isolated virtual environment, avoiding conflicts with system packages.

### (1a) System Requirements
The following should be installed by `apt`, `yum`, etc., depending on your OS.
```shell
sudo apt-get update 
sudo apt-get install -y \
        build-essential \
        intltool \
        lftp \
        librsync-dev \
        libffi-dev \
        libssl-dev \
        openssl \
        megatools \
        par2 \
        python3-dev \
        python3-lxml \
        python3-pip \
        python3-venv \
        python3 \
        rclone \
        rsync \
        rdiff \
        tzdata
```

### (1b) Install and Update Pipx
It is necessary to upgrade packaging tools to avoid installation failures.
```shell
sudo python3 -m pip install --upgrade pip pipx
sudo pipx --global ensurepath  # for all users
pipx ensurepath                # for single user
```

### (1c) Uninstall Previous Versions
If you have an existing duplicity not installed by `pipx`, you must uninstall it first:
```shell
which -a duplicity
# Use apt, yum, snap, or other command to remove existing instances.
```

### (1d) Install Duplicity
```shell
# For all users
sudo pipx --global install duplicity

# For single user
pipx install duplicity
```
*Note: Use `--suffix=version` to keep multiple versions (e.g., `duplicity-2.0`).*

## (2) APT Only Installation (Production)

Use this method if you are on a Debian-based system and want to install all runtime dependencies via `apt`, avoiding `pip` entirely.

```shell
sudo apt-get update 
sudo apt-get install -y \
        build-essential \
        intltool \
        lftp \
        librsync-dev \
        libffi-dev \
        libssl-dev \
        openssl \
        megatools \
        par2 \
        python3-dev \
        python3-lxml \
        python3-pip \
        python3-venv \
        python3 \
        rclone \
        rsync \
        rdiff \
        tzdata \
        python3-cryptography \
        python3-fasteners \
        python3-httplib2 \
        python3-socks \
        python3-gnupg \
        python3-requests \
        python3-requests-oauthlib \
        python3-azure-storage-blob \
        python3-b2sdk \
        python3-boto3 \
        python3-botocore \
        python3-dropbox \
        python3-googleapi \
        python3-google-auth-oauthlib \
        python3-paramiko \
        python3-pexpect \
        python3-pydrive2 \
        python3-swiftclient
```

## (3) APT Only Installation (Development)

Use this method for development or testing. It includes all runtime dependencies plus testing and documentation tools.

```shell
sudo apt-get update 
sudo apt-get install -y \
        build-essential \
        intltool \
        lftp \
        librsync-dev \
        libffi-dev \
        libssl-dev \
        openssl \
        megatools \
        par2 \
        python3-dev \
        python3-lxml \
        python3-pip \
        python3-venv \
        python3 \
        rclone \
        rsync \
        rdiff \
        tzdata \
        python3-cryptography \
        python3-fasteners \
        python3-httplib2 \
        python3-socks \
        python3-gnupg \
        python3-requests \
        python3-requests-oauthlib \
        python3-azure-storage-blob \
        python3-b2sdk \
        python3-boto3 \
        python3-botocore \
        python3-dropbox \
        python3-googleapi \
        python3-google-auth-oauthlib \
        python3-paramiko \
        python3-pexpect \
        python3-pydrive2 \
        python3-swiftclient \
        python3-setuptools \
        python3-setuptools-gettext \
        black \
        python3-coverage \
        python3-pycodestyle \
        pylint \
        python3-pytest \
        python3-pytest-cov \
        python3-pytest-timeout \
        python3-pytest-xdist \
        python3-myst-parser \
        python3-sphinx
```
