Skip to main content

Local Installation (Python + pip)

This guide explains how to install dtx in your local Python environment.
Recommended if you plan to:

  • Develop locally
  • Run models like Tiny-LLM, GPT-2, or Hugging Face directly in your environment
  • Avoid external tools like Docker

Prerequisites​

  • Python >= 3.8
  • pip (Python package manager)
  • Git (optional, if you plan to clone templates manually)

Check your Python and pip version:

python --version
pip --version

Step 1: Install dtx​

πŸ‘‰ If you already have PyTorch installed​

Install only dtx:

pip install dtx

Use this if you have an existing PyTorch setup.


Install dtx with the [pytorch] extras to include everything you need for local model execution:

pip install dtx[pytorch]

This installs:

  • torch β€” Core deep learning library
  • transformers β€” Hugging Face models

Recommended if you plan to run models locally without cloud APIs.


Step 2: Verify Installation​

Check if dtx is installed and accessible:

dtx --help

You should see the list of available commands.

If you see an error, check your PATH or virtual environment setup.


Optional: Create a Virtual Environment (Best Practice)​

To isolate your dependencies, it’s best to use a virtual environment.

Linux/macOS:​

python -m venv .venv
source .venv/bin/activate
pip install dtx[pytorch]

Windows:​

python -m venv .venv
.venv\Scripts\activate
pip install dtx[pytorch]

🧩 Tip: This avoids dependency conflicts with other Python projects.


Summary​

ScenarioCommand
Existing PyTorch installationpip install dtx
No PyTorch installed (recommended)pip install dtx[pytorch]
Verify installationdtx --help

Next Steps​

  • Check available datasets:

    dtx datasets list
  • Test a local LLM:

    dtx redteam run --agent hf_model --url arnir0/Tiny-LLM --dataset beaver --eval ibm38
  • Try dummy agent test (no model needed):

    dtx redteam run --agent echo --dataset beaver --eval ibm38