Requirements
The Premier League library requires Python 3.9 or higher:Supported Python versions: 3.9, 3.10, 3.11, and 3.12
Basic installation
Install the core library using pip:requests==2.28.1- HTTP library for data fetchingrequests-cache==1.2.1- Caching layer for API requestslxml==5.3.1- XML/HTML parsingbeautifulsoup4==4.12.3- Web scraping utilitiesprettytable==3.11.0- Console table formattingPyYAML==6.0.2- YAML configuration supportpandas==2.2.3- Data manipulation and analysistqdm==4.67.1- Progress barsSQLAlchemy==2.0.38- Database ORMappdirs==1.4.4- Platform-specific directory paths
Optional dependencies
The library provides optional extras for specialized features. Install only what you need:PDF export extras
Installingpremier_league[pdf] adds PDF generation capabilities:
reportlab==4.0.4- PDF creation library
RankingTable.get_ranking_pdf()- Color-coded standings reportsPlayerSeasonLeaders.get_top_stats_pdf()- Formatted player statistics
Without the PDF extra, attempting to use PDF export methods will raise an
ImportError with installation instructions.API server extras
Installingpremier_league[api] adds Flask-based REST API capabilities:
flask==3.0.0- Web frameworkflask-caching==2.3.0- Response cachingflask-cors==5.0.0- Cross-origin resource sharingflask-limiter==3.11- Rate limitinggunicorn==23.0.0- Production WSGI server
run_server()function for launching API servers- Production-ready deployment with Gunicorn
- Built-in rate limiting and caching
- CORS configuration
Lambda deployment extras
Installingpremier_league[lambda] adds AWS Lambda deployment capabilities:
boto3==1.37.18- AWS SDK for Python
- Serverless API deployment to AWS Lambda
- S3 integration for file exports
- Pre-configured Serverless Framework configuration
Install all extras
For complete functionality, install all optional dependencies:- PDF export methods
- Flask API server
- AWS Lambda deployment
Database initialization
Automatic setup
The library automatically initializes a local SQLite database on first use:Default location:
- Linux:
~/.local/share/premier_league_data/premier_league.db - macOS:
~/Library/Application Support/premier_league_data/premier_league.db - Windows:
C:\Users\<username>\AppData\Local\premier_league_data\premier_league.db
Database seeding
The database is automatically seeded with:
- League metadata for all supported leagues
- Match history since 2017-2018 season
- Team information and relationships
- Game statistics with 100+ metrics per match
- Premier League
- La Liga
- Serie A
- Bundesliga
- Ligue 1
- EFL Championship
Verifying installation
Test your installation with this quick check:Development installation
For contributing to the library or local development:Editable mode (
-e) allows you to modify the source code and see changes immediately without reinstalling.Upgrading
Update to the latest version:Uninstalling
Remove the library completely:Uninstalling the library does not remove the local database. To completely remove all data, manually delete the database directory shown in the “Automatic setup” section above.
Troubleshooting
ImportError: No module named 'premier_league'
ImportError: No module named 'premier_league'
Ensure the package is installed in your active Python environment:If not found, reinstall:
PDF export not working
PDF export not working
Install the PDF extra:Verify installation:
run_server() raises ImportError
run_server() raises ImportError
Install the API extra:Verify Flask is installed:
Database initialization fails
Database initialization fails
Check directory permissions for the data directory. You can specify a custom location with write permissions:
SSL certificate errors when fetching data
SSL certificate errors when fetching data
This may occur on some systems with strict SSL verification. Update certifi:Or temporarily disable SSL verification (not recommended for production):
System requirements
Minimum specifications
- Python: 3.9 or higher
- Disk space: ~500 MB (including database)
- RAM: 512 MB minimum
- Network: Internet connection for data fetching
Recommended specifications
- Python: 3.11 or 3.12 (best performance)
- Disk space: 1 GB (for growth and caching)
- RAM: 2 GB or more
- Network: Stable broadband connection
Platform support
Linux
Fully supported on all major distributions (Ubuntu, Debian, Fedora, CentOS)
macOS
Supported on macOS 10.14 (Mojave) and later, including Apple Silicon (M1/M2)
Windows
Supported on Windows 10 and Windows 11
Next steps
Quickstart guide
Get up and running with your first queries in 5 minutes
API reference
Explore the complete API documentation