mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2025-12-05 19:17:52 -06:00
- Add architecture detection to rebuild-site.sh to prevent Rosetta mismatches - Add fix-venv-architecture.sh script to resolve venv architecture issues - Ensure Python venv matches system architecture before building
27 lines
813 B
Bash
Executable File
27 lines
813 B
Bash
Executable File
#!/bin/bash
|
|
# Fix architecture mismatches in venv
|
|
# This script reinstalls packages that may have architecture issues
|
|
|
|
if [ ! -f ".venv/bin/activate" ]; then
|
|
echo "❌ Error: .venv not found. Run this from the project root."
|
|
exit 1
|
|
fi
|
|
|
|
echo "🔍 Checking venv architecture..."
|
|
source .venv/bin/activate
|
|
|
|
PYTHON_ARCH=$(python -c "import platform; print(platform.machine())")
|
|
SYSTEM_ARCH=$(uname -m)
|
|
|
|
echo "Python architecture: $PYTHON_ARCH"
|
|
echo "System architecture: $SYSTEM_ARCH"
|
|
|
|
if [ "$PYTHON_ARCH" != "$SYSTEM_ARCH" ]; then
|
|
echo "⚠️ Architecture mismatch detected!"
|
|
echo " Reinstalling problematic packages..."
|
|
pip install --force-reinstall --no-cache-dir rpds jsonschema referencing
|
|
echo "✅ Packages reinstalled"
|
|
else
|
|
echo "✅ Architecture match - no action needed"
|
|
fi
|