Documentation

Installation Guide

AI-Powered Pest Detection & Pesticide Recommendation System - Final Year Project with Source Code

Step-by-step Setup Verified Instructions Chat Support
Back to Project
Complete Guide

Complete Installation Guide for All Operating Systems

Table of Contents


Windows Installation

Step 1: Install Python

  1. Visit python.org/downloads
  2. Download Python 3.8 or higher (recommended: Python 3.11)
  3. Run the installer
  4. Important: Check the box "Add Python to PATH" at the bottom of the installer
  5. Click "Install Now"
  6. Wait for installation to complete

Step 2: Verify Python Installation

  1. Press Windows Key + R
  2. Type cmd and press Enter
  3. In the Command Prompt, type:
python --version
    

You should see something like: Python 3.11.x

Also verify pip:

pip --version
    

Step 3: Download the Project

Option A: Using Git

  1. Install Git from git-scm.com
  2. Open Command Prompt
  3. Navigate to where you want to store the project:
cd C:\Users\YourUsername\Documents
git clone [repository-url]
cd pest-detection-system
    

Option B: Using ZIP File

  1. Download the ZIP file from the repository
  2. Right-click the ZIP file and select "Extract All"
  3. Choose a destination folder (e.g., C:\Users\YourUsername\Documents)
  4. Open Command Prompt and navigate to the extracted folder:
cd C:\Users\YourUsername\Documents\pest-detection-system
    

Step 4: Create Virtual Environment

python -m venv venv
    

Activate the virtual environment:

venv\Scripts\activate
    

You should see (venv) at the beginning of your command prompt line

Step 5: Download Model Files

  1. Open this link in your browser: Google Drive - Model Files
  2. Download pest_model.pth and the dataset files
  3. Create a models folder in your project directory:
mkdir models
    
  1. Move the downloaded pest_model.pth file to the models folder

Step 6: Install Dependencies

pip install -r requirements.txt
    

This may take several minutes. Wait for all packages to install.

Step 7: Run the Application

python main.py
    

You should see output indicating the server is running:

 * Running on http://127.0.0.1:5001
    

Step 8: Access the Application

  1. Open your web browser (Chrome, Firefox, Edge, etc.)
  2. Navigate to: http://localhost:5001
  3. The pest detection system interface should appear

Step 9: Login (Optional)

To access the administrative dashboard:

  • Username: officer
  • Password: officer123

Stopping the Application

To stop the server:

  1. Go to the Command Prompt window
  2. Press Ctrl + C
  3. Type deactivate to exit the virtual environment

macOS Installation

Step 1: Install Homebrew (if not already installed)

  1. Open Terminal (Applications → Utilities → Terminal)
  2. Install Homebrew by running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  1. Follow the on-screen instructions

Step 2: Install Python

Option A: Using Homebrew (Recommended)

brew install python@3.11
    

Option B: Download from Python.org

  1. Visit python.org/downloads/macos
  2. Download the latest Python 3.8+ installer for macOS
  3. Open the downloaded .pkg file
  4. Follow the installation wizard

Step 3: Verify Python Installation

In Terminal, run:

python3 --version
pip3 --version
    

Step 4: Download the Project

Option A: Using Git

  1. Install Git (if not already installed):
brew install git
    
  1. Clone the repository:
cd ~/Documents
git clone [repository-url]
cd pest-detection-system
    

Option B: Using ZIP File

  1. Download the ZIP file from the repository
  2. Double-click to extract it
  3. Move the folder to your desired location (e.g., Documents)
  4. Open Terminal and navigate to the folder:
cd ~/Documents/pest-detection-system
    

Step 5: Create Virtual Environment

python3 -m venv venv
    

Activate the virtual environment:

source venv/bin/activate
    

You should see (venv) at the beginning of your terminal prompt

Step 6: Download Model Files

  1. Open this link: Google Drive - Model Files
  2. Download pest_model.pth and dataset files
  3. Create models directory:
mkdir -p models
    
  1. Move the downloaded files to the models folder using Finder or:
mv ~/Downloads/pest_model.pth ./models/
    

Step 7: Install Dependencies

pip3 install -r requirements.txt
    

Wait for all packages to download and install

Step 8: Run the Application

python3 main.py
    

Look for the message:

 * Running on http://127.0.0.1:5001
    

Step 9: Access the Application

  1. Open Safari, Chrome, or Firefox
  2. Go to: http://localhost:5001
  3. The application should load

Step 10: Login (Optional)

  • Username: officer
  • Password: officer123

Stopping the Application

  1. Go to Terminal
  2. Press Control + C
  3. Type deactivate to exit virtual environment

Linux Installation

For Ubuntu/Debian-based Systems

Step 1: Update System Packages

sudo apt update
sudo apt upgrade -y
    

Step 2: Install Python and Required Tools

sudo apt install python3 python3-pip python3-venv git -y
    

Step 3: Verify Installation

python3 --version
pip3 --version
git --version
    

Step 4: Download the Project

Option A: Using Git

cd ~/Documents
git clone [repository-url]
cd pest-detection-system
    

Option B: Using ZIP File

cd ~/Documents
unzip pest-detection-system.zip
cd pest-detection-system
    

Step 5: Create Virtual Environment

python3 -m venv venv
    

Activate virtual environment:

source venv/bin/activate
    

Step 6: Download Model Files

  1. Download from: Google Drive
  2. Create models directory:
mkdir -p models
    
  1. Move downloaded file:
mv ~/Downloads/pest_model.pth ./models/
    

Step 7: Install Dependencies

pip3 install -r requirements.txt
    

Step 8: Run the Application

python3 main.py
    

Step 9: Access the Application

Open browser and navigate to: http://localhost:5001

For Fedora/RHEL/CentOS Systems

Step 1: Update System

sudo dnf update -y
    

Step 2: Install Python and Tools

sudo dnf install python3 python3-pip python3-virtualenv git -y
    

Step 3-9: Follow the same steps as Ubuntu

The remaining steps are identical to the Ubuntu installation process above

For Arch Linux Systems

Step 1: Update System

sudo pacman -Syu
    

Step 2: Install Python and Tools

sudo pacman -S python python-pip python-virtualenv git
    

Step 3-9: Follow the same steps as Ubuntu

The remaining steps are identical to the Ubuntu installation process

Login Credentials

  • Username: officer
  • Password: officer123

Stopping the Application

  1. Press Ctrl + C in the terminal
  2. Type deactivate to exit virtual environment

Troubleshooting Common Issues

Issue 1: "Python is not recognized" (Windows)

Solution:

  1. Reinstall Python and make sure to check "Add Python to PATH"
  2. Or manually add Python to PATH:
    • Search for "Environment Variables" in Windows Search
    • Click "Environment Variables"
    • Under "System Variables", find "Path"
    • Click "Edit" and add Python installation path (usually C:\Python311)

Issue 2: "pip: command not found"

Solution:

On Linux/macOS, use pip3 instead of pip:

pip3 install -r requirements.txt
    

Issue 3: "Permission denied" (Linux/macOS)

Solution:

Don't use sudo with pip inside a virtual environment. Make sure virtual environment is activated:

source venv/bin/activate
    

Issue 4: "Module not found" error

Solution:

  1. Make sure virtual environment is activated
  2. Reinstall dependencies:
pip install -r requirements.txt --force-reinstall
    

Issue 5: "Port 5001 already in use"

Solution:

Windows:

netstat -ano | findstr :5001
taskkill /PID [PID_NUMBER] /F
    

Linux/macOS:

lsof -ti:5001 | xargs kill -9
    

Issue 6: Model file not found

Solution:

  1. Verify the models folder exists in project root
  2. Check that pest_model.pth is inside the models folder
  3. Verify file permissions (Linux/macOS):
chmod 644 models/pest_model.pth
    

Issue 7: Slow installation or timeouts

Solution:

Use a different pip mirror:

pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
    

Issue 8: Virtual environment won't activate

Windows:

If you get an execution policy error, run PowerShell as Administrator and execute:

Set-ExecutionPolicy RemoteSigned
    

Then try activating again:

venv\Scripts\activate
    

Linux/macOS:

Make sure activation script is executable:

chmod +x venv/bin/activate
source venv/bin/activate
    

Issue 9: Browser can't connect to localhost

Solution:

  1. Check firewall settings
  2. Try accessing via 127.0.0.1:5001 instead of localhost:5001
  3. Check if application is actually running in the terminal

Issue 10: Database errors

Solution:

  1. Delete any existing database files
  2. Restart the application to recreate the database

Getting Additional Help

If you encounter issues not covered here:

  1. Check the error message carefully
  2. Search for the error online
  3. Check the project's issue tracker on GitHub
  4. Contact the development team

System Requirements

Minimum Requirements

  • Operating System: Windows 10/11, macOS 10.14+, or Linux (Ubuntu 18.04+, Fedora 30+, etc.)
  • RAM: 4 GB (8 GB recommended)
  • Disk Space: 2 GB free space
  • Python: 3.8 or higher
  • Internet Connection: Required for initial setup and downloading dependencies

Recommended Requirements

  • RAM: 8 GB or more
  • Processor: Multi-core processor (Intel i5/AMD Ryzen 5 or better)
  • GPU: Optional but recommended for faster processing (NVIDIA CUDA-compatible)
  • Disk Space: 5 GB free space

Next Steps After Installation

  1. Test the System: Upload a sample pest image to verify detection works correctly
  2. Explore Features: Navigate through the interface to understand available features
  3. Access Admin Panel: Login with officer credentials to manage the system
  4. Review Documentation: Check for additional documentation files in the project folder
  5. Configure Settings: Adjust any settings as needed for your use case

Need Help?

Our team is here to assist you with installation and setup.

Chat with Us
Chat with us