Skip to main content

Installation

This guide will help you install SwissKnife and configure all required dependencies for optimal functionality.

Prerequisites

Python 3.13 or higher is required. SwissKnife uses modern Python features and requires Python 3.13+.
Verify your Python version:
python --version
# or
python3 --version

Install SwissKnife

1

Clone the repository

Clone the SwissKnife repository to your local machine:
git clone https://github.com/naineel1209/swissknife.git
cd swissknife
2

Install dependencies

Choose one of the following installation methods:
# Install or upgrade uv
pip install uv --upgrade

# Sync dependencies and create virtual environment
uv sync

# Activate the virtual environment
source .venv/bin/activate  # Linux/macOS
.venv\Scripts\activate     # Windows (CMD)
.\.venv\Scripts\Activate.ps1  # Windows (PowerShell)
3

Verify installation

Test that SwissKnife is working:
python solution.py --help
You should see the help menu with available commands.

Core Dependencies

SwissKnife automatically installs the following Python packages:
  • patool (≥4.0.1) - Universal archive extraction and creation
  • pdflatex (≥0.1.3) - PDF generation support
  • pillow (≥11.3.0) - Image processing and conversion
  • pydub (≥0.25.1) - Audio manipulation
  • pypandoc-binary (≥1.15) - Document conversion with embedded Pandoc
  • imageio-ffmpeg (≥0.6.0) - Video and audio conversion backend
  • google-genai (≥1.39.1) - AI-powered summarization
  • pypdf (≥6.1.1) - PDF merge and split operations
  • py7zr (≥1.0.0) - 7-Zip archive handling

Optional Dependencies

Certain features require additional system-level dependencies.

LaTeX (For PDF Conversion)

PDF conversion from documents requires a LaTeX distribution. Choose the installation method for your operating system:
sudo apt update
sudo apt install -y texlive-latex-base \
                    texlive-latex-recommended \
                    texlive-fonts-recommended \
                    texlive-latex-extra

Archive Tools (For 7Z and RAR)

Some archive formats require external command-line tools:
sudo apt update
sudo apt install p7zip-full
sudo apt update
sudo apt install unrar rar

AI Summarization Setup

1

Get Google API Key

  1. Visit AI Studio
  2. Sign in with your Google account
  3. Create a new project
  4. Generate an API key
2

Set environment variable

Configure the API key as an environment variable:
export GOOGLE_API_KEY="your_api_key_here"

# Add to ~/.bashrc or ~/.zshrc for persistence
echo 'export GOOGLE_API_KEY="your_api_key_here"' >> ~/.bashrc
3

Verify API key

Test that the API key is configured correctly:
python solution.py summarize --help
Keep your API key secure and never commit it to version control. The AI summarization feature requires internet connectivity and has a 100MB file size limit.

Troubleshooting

SwissKnife requires Python 3.13+. If you see version-related errors:
# Check your Python version
python --version

# Install Python 3.13 or higher from python.org
# Or use pyenv to manage multiple Python versions
If you see “xelatex not found” or similar errors:
  1. Verify LaTeX is installed: xelatex --version
  2. Ensure LaTeX binaries are in your PATH
  3. Restart your terminal after installation
For .7z or .rar format errors:
  1. Verify the tools are installed: 7z --help or unrar --help
  2. Ensure the tools are in your system PATH
  3. On Windows, check PATH environment variable includes the tool directories
If you see “Module not found” errors:
# Ensure virtual environment is activated
source .venv/bin/activate  # Linux/macOS

# Reinstall dependencies
uv sync
# or
pip install -r requirements.txt

Next Steps

Quick Start Guide

Learn how to use SwissKnife with practical examples and common workflows

Build docs developers (and LLMs) love