Python Requirements Guide for iDrv5-MyFR8
This guide explains the Python dependencies for the iDrv5-MyFR8 logistics management platform and how to use them for different deployment scenarios.
Overview
Section titled “Overview”This guide explains the Python dependencies for the iDrv5-MyFR8 logistics management platform and how to use them for different deployment scenarios.
Requirements Files
Section titled “Requirements Files”1. REQUIREMENTS_PRODUCTION.txt
Section titled “1. REQUIREMENTS_PRODUCTION.txt”For production deployments on third-party servers
- Contains all dependencies needed to run the application in production
- Version numbers are pinned for stability
- Optimized for performance and security
2. REQUIREMENTS_DEVELOPMENT.txt
Section titled “2. REQUIREMENTS_DEVELOPMENT.txt”For local development and testing
- Includes all production dependencies
- Adds development tools, testing frameworks, and debugging utilities
- Useful for setting up local development environments
3. Replit Environment
Section titled “3. Replit Environment”Note: Replit manages its own requirements.txt file automatically. The files above are for deploying to external servers.
Production Deployment Usage
Section titled “Production Deployment Usage”Standard Python Installation
Section titled “Standard Python Installation”# Install production dependenciespip install -r REQUIREMENTS_PRODUCTION.txt
# Or for developmentpip install -r REQUIREMENTS_DEVELOPMENT.txtDocker Deployment
Section titled “Docker Deployment”# In your DockerfileCOPY REQUIREMENTS_PRODUCTION.txt /app/RUN pip install -r REQUIREMENTS_PRODUCTION.txtVirtual Environment Setup
Section titled “Virtual Environment Setup”# Create virtual environmentpython -m venv venvsource venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependenciespip install -r REQUIREMENTS_PRODUCTION.txtKey Dependencies Explained
Section titled “Key Dependencies Explained”Core Framework
Section titled “Core Framework”- Flask 3.0.3: Web application framework
- SQLAlchemy 2.0.31: Database ORM
- Gunicorn 23.0.0: WSGI HTTP server for production
Database
Section titled “Database”- psycopg2-binary: PostgreSQL adapter
- Flask-SQLAlchemy: Flask-SQLAlchemy integration
- Flask-Migrate: Database migrations
Authentication & Security
Section titled “Authentication & Security”- Flask-Login: User session management
- Flask-Dance: OAuth integration
- Flask-WTF: Form handling and CSRF protection
Business Logic
Section titled “Business Logic”- ortools: Route optimization algorithms
- pandas: Data manipulation and analysis
- WeasyPrint: PDF generation for reports
- opencv-python-headless: Image processing
Communication
Section titled “Communication”- twilio: SMS notifications
- sendgrid: Email notifications
- Flask-SocketIO: Real-time communication
AI & Machine Learning
Section titled “AI & Machine Learning”- openai: AI-powered features
- scikit-learn: Machine learning algorithms
System Dependencies
Section titled “System Dependencies”Some Python packages require system-level dependencies:
Ubuntu/Debian
Section titled “Ubuntu/Debian”sudo apt-get updatesudo apt-get install -y \ libpq-dev \ wkhtmltopdf \ tesseract-ocr \ poppler-utils \ libffi-dev \ libssl-devCentOS/RHEL
Section titled “CentOS/RHEL”sudo yum install -y \ postgresql-devel \ wkhtmltopdf \ tesseract \ poppler-utils \ libffi-devel \ openssl-develVersion Compatibility
Section titled “Version Compatibility”- Python: 3.11+ (recommended 3.11)
- PostgreSQL: 12+ (recommended 16+)
- Node.js: 18+ (for frontend build tools, if needed)
Development Setup
Section titled “Development Setup”- Clone the repository
- Set up virtual environment
- Install development dependencies
- Set up environment variables
- Initialize database
- Run the application
# Complete development setupgit clone [repository-url]cd idrv5-myfr8python -m venv venvsource venv/bin/activatepip install -r REQUIREMENTS_DEVELOPMENT.txtcp .env.example .env# Edit .env with your database credentialsflask db upgradepython main.pyProduction Deployment
Section titled “Production Deployment”For production deployment, use the deployment scripts and Docker configurations provided in the docs/ directory:
docs/DEPLOYMENT.md- Complete deployment guide (dev + production)Dockerfile- Docker container configurationdocker-compose.yml- Multi-container setupdeploy.sh- Automated deployment script
Troubleshooting
Section titled “Troubleshooting”Common Issues
Section titled “Common Issues”-
psycopg2 installation fails
- Install
libpq-dev(Ubuntu) orpostgresql-devel(CentOS) - Alternative: Use
psycopg2-binary(already included)
- Install
-
WeasyPrint installation fails
- Install
wkhtmltopdfsystem package - Ensure
libffi-devis installed
- Install
-
OpenCV installation fails
- Use
opencv-python-headlessfor server environments - Install system dependencies for image processing
- Use
-
ortools installation fails
- Ensure you have sufficient memory (>2GB) during installation
- Consider using pre-compiled wheels
Getting Help
Section titled “Getting Help”If you encounter issues:
- Check the logs for specific error messages
- Verify system dependencies are installed
- Ensure you’re using the correct Python version
- Check the deployment guide for your specific platform
License Compliance
Section titled “License Compliance”All dependencies are open-source and compatible with commercial use. Review individual package licenses if needed for your deployment environment.