diff --git a/setup_mcp.sh b/setup_mcp.sh index 0f91014..510ecae 100755 --- a/setup_mcp.sh +++ b/setup_mcp.sh @@ -35,19 +35,34 @@ echo "" # Step 3: Install dependencies echo "Step 3: Installing Python dependencies..." + +# Check if we're in a virtual environment +if [[ -n "$VIRTUAL_ENV" ]]; then + echo -e "${GREEN}✓${NC} Virtual environment detected: $VIRTUAL_ENV" + PIP_INSTALL_CMD="pip install" +elif [[ -d "venv" ]]; then + echo -e "${YELLOW}⚠${NC} Virtual environment found but not activated" + echo "Activating venv..." + source venv/bin/activate + PIP_INSTALL_CMD="pip install" +else + echo "No virtual environment found. Using system pip with --user --break-system-packages flags" + PIP_INSTALL_CMD="pip3 install --user --break-system-packages" +fi + echo "This will install: mcp, requests, beautifulsoup4" read -p "Continue? (y/n) " -n 1 -r echo "" if [[ $REPLY =~ ^[Yy]$ ]]; then echo "Installing MCP server dependencies..." - pip3 install -r skill_seeker_mcp/requirements.txt || { + $PIP_INSTALL_CMD -r skill_seeker_mcp/requirements.txt || { echo -e "${RED}❌ Failed to install MCP dependencies${NC}" exit 1 } echo "Installing CLI tool dependencies..." - pip3 install requests beautifulsoup4 || { + $PIP_INSTALL_CMD requests beautifulsoup4 || { echo -e "${RED}❌ Failed to install CLI dependencies${NC}" exit 1 } @@ -78,7 +93,7 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then # Check if pytest is installed if ! command -v pytest &> /dev/null; then echo "Installing pytest..." - pip3 install pytest || { + $PIP_INSTALL_CMD pytest || { echo -e "${YELLOW}⚠${NC} Could not install pytest, skipping tests" } fi