A professional and robust script for updating all installed Python pip packages with comprehensive error handling, logging, and user feedback.
- 🔄 Automatic Package Updates: Updates all installed pip packages to their latest versions
- 📊 Progress Tracking: Real-time progress display with time estimation
- 📝 Comprehensive Logging: Detailed logs for troubleshooting and audit trails
- 🔒 Error Handling: Robust error handling with graceful failure recovery
- 💾 Backup System: Automatic backup of current requirements before updates
- 🎨 User-Friendly Interface: Colored output and clear status messages
- 🛠️ System Integration: Easy installation as a system-wide command
- Python 3.x
- pip
- Bash shell
- Root/sudo access (for system-wide installation)
git clone https://github.com/VictoKu1/PythonPipPackagesUpdateScript.git
cd PythonPipPackagesUpdateScript
chmod +x update.sh
./update.shgit clone https://github.com/VictoKu1/PythonPipPackagesUpdateScript.git
cd PythonPipPackagesUpdateScript
sudo ./manager.shAfter installation, you can use the updatePip command from anywhere in your system.
# Run the update script directly
./update.sh# Use the installed system command
updatePip# Interactive mode
sudo ./manager.sh
# Command line mode
sudo ./manager.sh install # Install updatePip command
sudo ./manager.sh remove # Remove updatePip command- Pre-flight Checks: Verifies pip and Python are available
- Backup Creation: Creates a backup of current package list
- Package Discovery: Generates a list of all installed packages
- Constraint Updates: Converts exact versions (==) to minimum versions (>=)
- Package Updates: Updates each package individually with progress tracking
- Error Reporting: Reports any failed updates
- Cleanup: Removes temporary files
The script provides:
- Colored output for different message types (info, warning, error, success)
- Progress bar showing completion percentage and time elapsed
- Detailed logs saved to
/tmp/pip_update_YYYYMMDD_HHMMSS.log - Backup files with timestamp for safety
- Automatic backups of current package list
- Error recovery - continues updating other packages if one fails
- Validation of all inputs and file operations
- Graceful exit on errors with helpful messages
- Permission Denied: Make sure to run with sudo for system-wide installation
- Pip Not Found: Ensure pip is installed and in your PATH
- Python Not Found: Ensure Python 3.x is installed and accessible
Check the log files in /tmp/ for detailed error information:
ls -la /tmp/pip_update_*.logIf something goes wrong, you can manually clean up:
sudo rm -f /usr/local/bin/updatePip
rm -f requirements.txt requirements_backup_*.txtFeel free to submit issues and enhancement requests!
This project is open source and available under the MIT License.
If you encounter any issues or have questions, please:
- Check the log files for detailed error information
- Review the troubleshooting section above
- Open an issue on the GitHub repository
Note: This script updates all installed packages. Use with caution in production environments and consider testing in a virtual environment first.