forked from agiresearch/A-mem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·66 lines (52 loc) · 2.1 KB
/
setup.sh
File metadata and controls
executable file
·66 lines (52 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
set -e
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${GREEN}=== AMemCP Setup Script ===${NC}"
# Check if Python 3.11 is available through pyenv
if ! pyenv versions | grep -q "3.11"; then
echo -e "${YELLOW}Python 3.11 not found in pyenv. Installing latest Python 3.11.x...${NC}"
pyenv install 3.11 --skip-existing
fi
# Get the latest installed 3.11.x version
PYTHON_VERSION=$(pyenv versions | grep -o "3.11.[0-9]*" | sort -V | tail -1)
if [ -z "$PYTHON_VERSION" ]; then
echo -e "${RED}Failed to find Python 3.11.x. Please install it manually using pyenv.${NC}"
exit 1
fi
echo -e "${GREEN}Using Python ${PYTHON_VERSION}${NC}"
# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo -e "${GREEN}Creating virtual environment in ./venv${NC}"
$(pyenv root)/versions/${PYTHON_VERSION}/bin/python -m venv venv
fi
# Activate virtual environment
echo -e "${GREEN}Activating virtual environment${NC}"
source venv/bin/activate
# Check if activation worked
if [[ "$VIRTUAL_ENV" != *"venv"* ]]; then
echo -e "${RED}Failed to activate virtual environment. Please run: source venv/bin/activate${NC}"
exit 1
fi
# Verify Python version in the virtual environment
VENV_PYTHON_VERSION=$(python --version)
echo -e "${GREEN}Virtual environment is using: ${VENV_PYTHON_VERSION}${NC}"
# Upgrade pip, setuptools, and wheel
echo -e "${GREEN}Upgrading pip, setuptools, and wheel${NC}"
pip install --upgrade pip setuptools wheel
# Install requirements
echo -e "${GREEN}Installing requirements from requirements.txt${NC}"
pip install -r requirements.txt
# Install package in development mode
echo -e "${GREEN}Installing package in development mode${NC}"
pip install -e .
echo -e "${GREEN}=== Setup complete! ===${NC}"
echo -e "${YELLOW}To activate this environment in the future, run:${NC}"
echo -e " source venv/bin/activate"
echo -e "${GREEN}To run the server:${NC}"
echo -e " amem-server"
# Keep the environment activated for the current shell
echo -e "${GREEN}Virtual environment is now active. You can start developing!${NC}"