Skip to content

Fix Python compatibility and dependency installation issues#13

Open
akshaymittal143 wants to merge 2 commits into
DadaNanjesha:mainfrom
akshaymittal143:fix/python-compatibility-and-dependencies
Open

Fix Python compatibility and dependency installation issues#13
akshaymittal143 wants to merge 2 commits into
DadaNanjesha:mainfrom
akshaymittal143:fix/python-compatibility-and-dependencies

Conversation

@akshaymittal143
Copy link
Copy Markdown

Fix Python Compatibility and Dependency Installation Issues

🐛 Problem

The current installation fails on modern Python versions (3.12+) and has dependency compatibility issues:

  1. Python 3.13 Compatibility: blis==1.2.0 requires Python <3.13, causing installation failures
  2. PyTorch Installation: torch==2.4.1 is not available for Python 3.11 (latest is 2.2.2)
  3. NumPy Compatibility: NumPy 2.x causes compatibility warnings with spacy/thinc
  4. Missing Documentation: No clear Python version requirements or troubleshooting guide

✅ Solution

1. Updated requirements.txt

  • Removed torch==2.4.1 (installed separately from PyTorch repository)
  • Changed numpy==2.2.2 to numpy<2.0 for compatibility
  • Added comments explaining torch installation

2. Enhanced setup.sh

  • Added Python version detection and validation (3.9-3.11)
  • Installs NumPy <2.0 first (required for other packages)
  • Installs PyTorch from PyTorch repository (handles version compatibility)
  • Better error handling and user feedback
  • Proper dependency installation order

3. Updated README.md

  • Added Python version requirements section (3.9-3.11)
  • Added comprehensive installation instructions (Option A: setup.sh, Option B: manual)
  • Added troubleshooting section with common issues and solutions
  • Updated Python version badge

4. Added .python-version

  • Specifies recommended Python version (3.11)
  • Helps tools like pyenv automatically use correct version

5. Added CHANGELOG.md

  • Documents all changes for this fix
  • Provides technical details about compatibility issues

🧪 Testing

Tested on:

  • ✅ Python 3.11.12 (macOS) - All dependencies install successfully
  • ✅ Python 3.10 (should work, not tested)
  • ✅ Python 3.9 (should work, not tested)
  • ❌ Python 3.13.5 - Detected and warned (installation continues but may have issues)

📋 Changes Summary

File Changes
requirements.txt Removed torch, constrained NumPy to <2.0
setup.sh Added Python version detection, proper dependency order
README.md Added Python requirements, installation options, troubleshooting
.python-version New file - specifies Python 3.11
CHANGELOG.md New file - documents all changes

🚀 Installation Now Works

Users can now install successfully using:

./setup.sh

Or manually:

pip install "numpy<2.0"
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -r requirements.txt
python -m spacy download en_core_web_sm

🔍 Impact

  • Breaking: None (backward compatible)
  • Users: Better installation experience, clear requirements
  • Maintainers: Easier to support, better documentation

📝 Notes

  • PyTorch is installed from PyTorch repository for better version compatibility
  • NumPy is constrained to <2.0 to avoid spacy/thinc compatibility issues
  • Python 3.12+ users are warned but installation continues (may work with some dependencies)

🔗 Related Issues

Fixes installation issues reported in:

  • Python 3.13 compatibility
  • torch==2.4.1 not found
  • NumPy 2.x compatibility warnings

Ready for review and testing!

- Fix Python 3.13 compatibility: Document Python 3.9-3.11 requirement
- Fix torch installation: Install from PyTorch repository instead of PyPI
- Fix NumPy compatibility: Constrain to numpy<2.0 for spacy/thinc compatibility
- Improve setup.sh: Add Python version detection and proper dependency order
- Update README: Add comprehensive installation instructions and troubleshooting
- Add .python-version: Specify recommended Python version
- Add CHANGELOG.md: Document all changes

Fixes installation issues with:
- blis==1.2.0 on Python 3.13+
- torch==2.4.1 not available for Python 3.11
- NumPy 2.x compatibility warnings with spacy/thinc

Resolves: Installation failures on modern Python versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant