> ## Documentation Index
> Fetch the complete documentation index at: https://r2r-patch-fix-ingestion.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Dependencies

# R2R Troubleshooting Guide: Dependency Conflicts

Dependency conflicts can occur when different components of the R2R system require incompatible versions of the same library or when there are conflicts between system-level dependencies. This guide will help you identify and resolve common dependency issues.

## 1. Identifying Dependency Conflicts

### Symptoms:

* Error messages mentioning version conflicts
* Unexpected behavior in specific components
* Installation or startup failures

### Common Error Messages:

* "ImportError: cannot import name X from Y"
* "AttributeError: module X has no attribute Y"
* "ModuleNotFoundError: No module named X"

## 2. Python Package Conflicts

### 2.1 Diagnosing the Issue

1. Check your Python environment:
   ```bash
   python --version
   pip list
   ```

2. Look for conflicting versions in the pip list output.

3. Use `pip check` to identify dependency conflicts:
   ```bash
   pip check
   ```

### 2.2 Resolving Python Package Conflicts

1. **Update R2R and its dependencies:**
   ```bash
   pip install --upgrade r2r[core]
   ```

2. **Use a virtual environment:**
   ```bash
   python -m venv r2r_env
   source r2r_env/bin/activate  # On Windows, use r2r_env\Scripts\activate
   pip install r2r[core]
   ```

3. **Manually resolve conflicts:**
   * Identify the conflicting packages
   * Upgrade or downgrade specific packages:
     ```bash
     pip install package_name==specific_version
     ```

4. **Use `pip-compile` for deterministic builds:**
   ```bash
   pip install pip-tools
   pip-compile requirements.in
   pip-sync requirements.txt
   ```

## 3. System-level Dependency Conflicts

### 3.1 Diagnosing System Conflicts

1. Check system library versions:
   ```bash
   ldd --version
   ldconfig -p | grep library_name
   ```

2. Look for error messages related to shared libraries:
   * "error while loading shared libraries"
   * "symbol lookup error"

### 3.2 Resolving System-level Conflicts

1. **Update system packages:**
   ```bash
   sudo apt update && sudo apt upgrade  # For Ubuntu/Debian
   sudo yum update  # For CentOS/RHEL
   ```

2. **Install missing libraries:**
   ```bash
   sudo apt install library_name  # For Ubuntu/Debian
   sudo yum install library_name  # For CentOS/RHEL
   ```

3. **Use container isolation:**
   * Consider using Docker to isolate the R2R environment from the host system.

## 4. Docker-specific Dependency Issues

### 4.1 Diagnosing Docker Issues

1. Check Docker image versions:
   ```bash
   docker images
   ```

2. Inspect Docker logs:
   ```bash
   docker logs container_name
   ```

### 4.2 Resolving Docker Dependency Conflicts

1. **Update Docker images:**
   ```bash
   docker pull ragtoriches/prod:main-unstructured
   ```

2. **Rebuild with no cache:**
   ```bash
   docker-compose build --no-cache
   ```

3. **Check Docker Compose file:**
   * Ensure all services are using compatible versions
   * Update service versions if necessary

## 6. Advanced Troubleshooting

### 6.1 Use Dependency Visualization Tools

1. Install `pipdeptree`:
   ```bash
   pip install pipdeptree
   ```

2. Visualize dependencies:
   ```bash
   pipdeptree -p r2r
   ```

### 6.2 Analyze Startup Sequences

1. Use verbose logging:
   ```bash
   R2R_LOG_LEVEL=DEBUG r2r serve
   ```

2. Analyze logs for import errors or version conflicts

### 6.3 Temporary Workarounds

1. **Pin problematic dependencies:**
   * Create a `constraints.txt` file with specific versions
   * Install with constraints:
     ```bash
     pip install -c constraints.txt r2r[core]
     ```

2. **Use compatibility mode:**
   * If available, run R2R with a compatibility flag to use older versions of certain components

## 7. Seeking Further Help

If you've tried these steps and still encounter issues:

1. Check the [R2R GitHub Issues](https://github.com/SciPhi-AI/R2R/issues) for similar problems and solutions
2. Join the [R2R Discord community](https://discord.gg/p6KqD2kjtB) for real-time support
3. Open a new issue on GitHub with:
   * Detailed description of the problem
   * Steps to reproduce
   * Environment details (OS, Python version, pip list output)
   * Relevant log snippets

Remember, when dealing with dependency conflicts, it's crucial to document your changes and test thoroughly after each modification to ensure you haven't introduced new issues while solving existing ones.
