Commit 89518e27 authored by Your Name's avatar Your Name

fix: consolidate all requirements into requirements.txt and fix import errors

- Moved crypto dependencies back to requirements.txt
- Updated aisbf.sh to exit with helpful error message if pip install fails
- Fixed StripeHandler -> StripePaymentHandler import
- Fixed PayPalHandler -> PayPalPaymentHandler import
- Removed requirements-crypto.txt (no longer needed)
parent fee1fee0
...@@ -161,7 +161,29 @@ ensure_venv() { ...@@ -161,7 +161,29 @@ ensure_venv() {
# Install requirements if requirements.txt exists # Install requirements if requirements.txt exists
if [ -f "$SHARE_DIR/requirements.txt" ]; then if [ -f "$SHARE_DIR/requirements.txt" ]; then
echo "Installing requirements from $SHARE_DIR/requirements.txt" echo "Installing requirements from $SHARE_DIR/requirements.txt"
"$VENV_DIR/bin/pip" install -r "$SHARE_DIR/requirements.txt" if ! "$VENV_DIR/bin/pip" install -r "$SHARE_DIR/requirements.txt"; then
echo ""
echo "=========================================="
echo "ERROR: Failed to install Python dependencies"
echo "=========================================="
echo ""
echo "Some packages require system libraries to build."
echo "If you see errors about 'coincurve', 'bip32', or 'secp256k1', install:"
echo ""
echo " Ubuntu/Debian:"
echo " sudo apt-get update"
echo " sudo apt-get install pkg-config libsecp256k1-dev build-essential"
echo ""
echo " RHEL/CentOS/Fedora:"
echo " sudo yum install pkgconfig libsecp256k1-devel gcc"
echo ""
echo " Alpine Linux:"
echo " sudo apk add pkgconfig libsecp256k1-dev gcc musl-dev"
echo ""
echo "After installing system dependencies, run this script again."
echo ""
exit 1
fi
# Force reinstall uvicorn in venv to ensure it's available inside the virtual environment # Force reinstall uvicorn in venv to ensure it's available inside the virtual environment
"$VENV_DIR/bin/pip" install --force-reinstall uvicorn "$VENV_DIR/bin/pip" install --force-reinstall uvicorn
fi fi
...@@ -174,7 +196,17 @@ ensure_venv() { ...@@ -174,7 +196,17 @@ ensure_venv() {
echo "Package upgrade detected, updating venv dependencies..." echo "Package upgrade detected, updating venv dependencies..."
# Only update requirements, aisbf is accessed from system site-packages # Only update requirements, aisbf is accessed from system site-packages
if [ -f "$SHARE_DIR/requirements.txt" ]; then if [ -f "$SHARE_DIR/requirements.txt" ]; then
"$VENV_DIR/bin/pip" install -r "$SHARE_DIR/requirements.txt" if ! "$VENV_DIR/bin/pip" install -r "$SHARE_DIR/requirements.txt"; then
echo ""
echo "=========================================="
echo "ERROR: Failed to update Python dependencies"
echo "=========================================="
echo ""
echo "Some packages require system libraries. See error messages above."
echo "You may need to install system dependencies (pkg-config, libsecp256k1-dev, build-essential)"
echo ""
exit 1
fi
# Force reinstall uvicorn in venv to ensure it's available inside the virtual environment # Force reinstall uvicorn in venv to ensure it's available inside the virtual environment
"$VENV_DIR/bin/pip" install --force-reinstall uvicorn "$VENV_DIR/bin/pip" install --force-reinstall uvicorn
fi fi
...@@ -194,7 +226,22 @@ update_venv() { ...@@ -194,7 +226,22 @@ update_venv() {
if [ $ALREADY_SATISFIED -ne 0 ]; then if [ $ALREADY_SATISFIED -ne 0 ]; then
echo "Installing new requirements (this will take a while!) ... " echo "Installing new requirements (this will take a while!) ... "
"$VENV_DIR/bin/pip" install -r "$SHARE_DIR/requirements.txt" if ! "$VENV_DIR/bin/pip" install -r "$SHARE_DIR/requirements.txt"; then
echo ""
echo "=========================================="
echo "ERROR: Failed to install Python dependencies"
echo "=========================================="
echo ""
echo "Some packages require system libraries. Install them with:"
echo ""
echo " Ubuntu/Debian:"
echo " sudo apt-get install pkg-config libsecp256k1-dev build-essential"
echo ""
echo " RHEL/CentOS:"
echo " sudo yum install pkgconfig libsecp256k1-devel gcc"
echo ""
exit 1
fi
# Force reinstall uvicorn in venv to ensure it's available inside the virtual environment # Force reinstall uvicorn in venv to ensure it's available inside the virtual environment
"$VENV_DIR/bin/pip" install --force-reinstall uvicorn "$VENV_DIR/bin/pip" install --force-reinstall uvicorn
echo "[OK]" echo "[OK]"
......
...@@ -18,14 +18,14 @@ class PaymentService: ...@@ -18,14 +18,14 @@ class PaymentService:
from aisbf.payments.crypto.wallet import CryptoWalletManager from aisbf.payments.crypto.wallet import CryptoWalletManager
from aisbf.payments.crypto.pricing import CryptoPriceService from aisbf.payments.crypto.pricing import CryptoPriceService
from aisbf.payments.crypto.monitor import BlockchainMonitor from aisbf.payments.crypto.monitor import BlockchainMonitor
from aisbf.payments.fiat.stripe_handler import StripeHandler from aisbf.payments.fiat.stripe_handler import StripePaymentHandler
from aisbf.payments.fiat.paypal_handler import PayPalHandler from aisbf.payments.fiat.paypal_handler import PayPalPaymentHandler
self.wallet_manager = CryptoWalletManager(db_manager, config['encryption_key']) self.wallet_manager = CryptoWalletManager(db_manager, config['encryption_key'])
self.price_service = CryptoPriceService(db_manager, config) self.price_service = CryptoPriceService(db_manager, config)
self.blockchain_monitor = BlockchainMonitor(db_manager, config) self.blockchain_monitor = BlockchainMonitor(db_manager, config)
self.stripe_handler = StripeHandler(db_manager, config) self.stripe_handler = StripePaymentHandler(db_manager, config)
self.paypal_handler = PayPalHandler(db_manager, config) self.paypal_handler = PayPalPaymentHandler(db_manager, config)
# Initialize subscription sub-services # Initialize subscription sub-services
from aisbf.payments.subscription.manager import SubscriptionManager from aisbf.payments.subscription.manager import SubscriptionManager
......
# Optional cryptocurrency payment dependencies
# These require system libraries: pkg-config, libsecp256k1-dev
# Install system dependencies first:
# Ubuntu/Debian: sudo apt-get install pkg-config libsecp256k1-dev build-essential
# RHEL/CentOS: sudo yum install pkgconfig libsecp256k1-devel gcc
# Alpine: sudo apk add pkgconfig libsecp256k1-dev gcc musl-dev
bip32>=3.4
mnemonic>=0.20
bitcoinlib>=0.6.14
web3>=6.0.0
eth-account>=0.9.0
...@@ -27,11 +27,18 @@ flask ...@@ -27,11 +27,18 @@ flask
curl_cffi>=0.5.0 # Optional: For TLS fingerprinting to bypass Cloudflare (Claude OAuth2) curl_cffi>=0.5.0 # Optional: For TLS fingerprinting to bypass Cloudflare (Claude OAuth2)
paypalrestsdk # PayPal REST API SDK paypalrestsdk # PayPal REST API SDK
# Payment system dependencies (core) # Payment system dependencies
stripe>=5.0.0 stripe>=5.0.0
httpx>=0.24.0
cryptography>=41.0.0 cryptography>=41.0.0
# Cryptocurrency dependencies moved to requirements-crypto.txt (optional) # Cryptocurrency payment dependencies
# These require system libraries (pkg-config, libsecp256k1-dev) # These require system libraries: pkg-config, libsecp256k1-dev, build-essential
# Install with: pip install -r requirements-crypto.txt # If installation fails, install system dependencies first:
\ No newline at end of file # Ubuntu/Debian: sudo apt-get install pkg-config libsecp256k1-dev build-essential
# RHEL/CentOS: sudo yum install pkgconfig libsecp256k1-devel gcc
# Alpine: sudo apk add pkgconfig libsecp256k1-dev gcc musl-dev
bip32>=3.4
mnemonic>=0.20
bitcoinlib>=0.6.14
web3>=6.0.0
eth-account>=0.9.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment