diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..2c07333 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.11 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..815858a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,27 @@ +# Changelog + +## [Unreleased] - Fix Python Compatibility Issues + +### Fixed +- Fixed Python 3.13 compatibility issue with `blis==1.2.0` by documenting Python version requirements (3.9-3.11) +- Fixed `torch==2.4.1` installation by installing from PyTorch repository instead of PyPI +- Fixed NumPy 2.x compatibility issues by constraining to `numpy<2.0` for spacy/thinc compatibility +- Improved `setup.sh` with Python version detection and proper dependency installation order +- Updated README with comprehensive installation instructions and troubleshooting section + +### Changed +- Updated `requirements.txt` to remove torch (installed separately) and constrain NumPy version +- Enhanced `setup.sh` with error handling and version checking +- Updated README with Python version requirements and alternative installation methods + +### Added +- Added `.python-version` file to specify recommended Python version +- Added comprehensive troubleshooting section to README +- Added Python version detection in setup script + +### Technical Details +- **Python Compatibility**: Now explicitly supports Python 3.9, 3.10, and 3.11 +- **PyTorch Installation**: Uses PyTorch repository for better version compatibility +- **NumPy Version**: Constrained to <2.0 to avoid compatibility issues with spacy/thinc +- **Dependency Order**: Setup script now installs dependencies in correct order + diff --git a/README.md b/README.md index d9f8c6a..e460d28 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Transform AI-generated text into **formal, human-like, and academic writing** with ease, avoids AI detector! 🚀 ![Streamlit](https://img.shields.io/badge/Streamlit-Web_App-red?style=flat-square&logo=streamlit) -![Python](https://img.shields.io/badge/Python-3.10-blue?style=flat-square&logo=python) +![Python](https://img.shields.io/badge/Python-3.9%20%7C%203.10%20%7C%203.11-blue?style=flat-square&logo=python) ![License](https://img.shields.io/github/license/DadaNanjesha/AI-Text-Humanizer-App?style=flat-square) @@ -32,6 +32,11 @@ Building new version of this project here in this repos https://github.com/DadaN ## 📥 Installation +### ⚠️ Python Version Requirements +- **Required**: Python 3.9, 3.10, or 3.11 +- **Not supported**: Python 3.12+ (dependency compatibility issues) +- **Not supported**: Python 3.8 or earlier + ### 1️⃣ Clone the Repository ```bash git clone https://github.com/DadaNanjesha/AI-Text-Humanizer-App.git @@ -40,23 +45,51 @@ cd AI-Text-Humanizer-App ### 2️⃣ Set Up a Virtual Environment (Recommended) ```bash -python -m venv venv +python3.11 -m venv venv # Use Python 3.9, 3.10, or 3.11 source venv/bin/activate # Linux/Mac venv\Scripts\activate # Windows ``` ### 3️⃣ Install Dependencies + +**Option A: Using setup.sh (Recommended)** ```bash -pip install --upgrade pip -pip install -r requirements.txt +chmod +x setup.sh +./setup.sh ``` -### 4️⃣ Download NLP Models +**Option B: Manual Installation** ```bash +pip install --upgrade pip setuptools wheel + +# Install NumPy first (must be <2.0 for compatibility) +pip install "numpy<2.0" + +# Install PyTorch from PyTorch repository +pip install torch --index-url https://download.pytorch.org/whl/cpu + +# Install other dependencies +pip install -r requirements.txt + +# Download NLP models python -m spacy download en_core_web_sm -python -c "import nltk; nltk.download('punkt'); nltk.download('wordnet'); nltk.download('averaged_perceptron_tagger');" +python -c "import nltk; nltk.download('punkt', quiet=True); nltk.download('wordnet', quiet=True); nltk.download('averaged_perceptron_tagger', quiet=True)" ``` +### 🔧 Troubleshooting + +**Issue: `blis==1.2.0` installation fails** +- **Solution**: Use Python 3.9-3.11. Python 3.12+ is not supported. + +**Issue: `torch==2.4.1` not found** +- **Solution**: Install torch from PyTorch repository: `pip install torch --index-url https://download.pytorch.org/whl/cpu` + +**Issue: NumPy compatibility warnings** +- **Solution**: NumPy 2.x is not compatible. The setup script automatically installs NumPy <2.0. + +**Issue: spaCy model download fails** +- **Solution**: Ensure you have internet connection and try: `python -m spacy download en_core_web_sm` + --- ## 🖥️ Usage diff --git a/requirements.txt b/requirements.txt index b52a567..8656ba5 100644 Binary files a/requirements.txt and b/requirements.txt differ diff --git a/setup.sh b/setup.sh old mode 100644 new mode 100755 index 265e7c6..3ddb1a2 --- a/setup.sh +++ b/setup.sh @@ -1,14 +1,61 @@ #!/usr/bin/env bash -echo "Installing pip dependencies..." -pip install --upgrade pip +# AI Text Humanizer App - Setup Script +# This script handles dependency installation with proper version compatibility + +set -e # Exit on error + +echo "🔧 Setting up AI Text Humanizer App..." + +# Check Python version +PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}' | cut -d. -f1,2) +PYTHON_MAJOR=$(echo $PYTHON_VERSION | cut -d. -f1) +PYTHON_MINOR=$(echo $PYTHON_VERSION | cut -d. -f2) + +echo "📌 Detected Python version: $PYTHON_VERSION" + +# Check if Python version is compatible (3.9-3.11) +if [ "$PYTHON_MAJOR" -lt 3 ] || ([ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -lt 9 ]); then + echo "❌ Error: Python 3.9 or higher is required. Found Python $PYTHON_VERSION" + echo "Please upgrade Python to 3.9, 3.10, or 3.11" + exit 1 +fi + +if [ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -gt 11 ]; then + echo "⚠️ Warning: Python 3.12+ detected. Some dependencies may not be compatible." + echo "Consider using Python 3.9-3.11 for best compatibility." + echo "Continuing with installation..." +fi + +# Upgrade pip +echo "📦 Upgrading pip..." +pip install --upgrade pip setuptools wheel + +# Install NumPy first (required for other packages, must be <2.0 for spacy compatibility) +echo "📦 Installing NumPy (compatible version)..." +pip install "numpy<2.0" + +# Install torch from PyTorch repository (handles version compatibility automatically) +echo "📦 Installing PyTorch (CPU version) from PyTorch repository..." +pip install torch --index-url https://download.pytorch.org/whl/cpu + +# Install other dependencies from requirements.txt +echo "📦 Installing other dependencies..." pip install -r requirements.txt -pip install streamlit spacy sentence-transformers nltk -echo "Installing spaCy model..." +# Download spaCy model +echo "📥 Downloading spaCy model (en_core_web_sm)..." python -m spacy download en_core_web_sm -python -m nltk.downloader all +# Download NLTK resources +echo "📥 Downloading NLTK resources..." +python -c "import nltk; nltk.download('punkt', quiet=True); nltk.download('wordnet', quiet=True); nltk.download('averaged_perceptron_tagger', quiet=True); nltk.download('punkt_tab', quiet=True); nltk.download('averaged_perceptron_tagger_eng', quiet=True)" || { + echo "⚠️ Warning: Some NLTK downloads may have failed, but continuing..." +} -echo "Downloading NLTK data..." -python -c "import nltk; nltk.download('punkt_tab', quiet=True); nltk.download('punkt', quiet=True); nltk.download('wordnet', quiet=True); nltk.download('averaged_perceptron_tagger', quiet=True)" +echo "" +echo "✅ Installation complete!" +echo "" +echo "🚀 To run the app:" +echo " streamlit run main.py" +echo ""