|
1 | | -# Development Environment Setup Guide on Windows using WSL |
2 | | - |
3 | | -## Introduction |
| 1 | +# Development Environment Setup Guide on Windows using WSL(Windows Subsystem for Linux) |
| 2 | +# Introduction |
4 | 3 | This guide establishes a WSL-based development environment on Windows, specifically designed for the GenAI IDP accelerator. |
5 | 4 |
|
6 | | -**Purpose**: Provides a Linux development environment directly on Windows without virtualization overhead, combining native Windows tools with a complete Linux development stack. |
7 | | - |
8 | | -**When to use this guide**: |
9 | | -- You're developing on Windows and need Linux compatibility |
10 | | -- You want to avoid Docker Desktop or VM overhead |
11 | | -- You need consistent behavior with the project's Linux-based AWS infrastructure |
12 | | -- You prefer integrated Windows/Linux development workflows |
13 | | - |
14 | | -**What you'll achieve**: A seamless development setup where you can use Windows tools (VS Code, browsers, file explorers) while running the GenAI IDP accelerator in a native Linux environment. |
15 | | - |
16 | | -## Prerequisites |
| 5 | +Purpose: Provides a Linux development environment directly on Windows without virtualization overhead, combining native Windows tools with a complete Linux |
| 6 | +development stack. This approach eliminates cross-platform compatibility issues while maintaining familiar Windows workflows. |
17 | 7 |
|
18 | | -**Official Microsoft WSL Installation Guide**: https://docs.microsoft.com/en-us/windows/wsl/install |
| 8 | +When to use this guide: |
| 9 | +• You're developing on Windows and need Linux compatibility |
| 10 | +• You want to avoid Docker Desktop or VM overhead |
| 11 | +• You need consistent behavior with the project's Linux-based AWS infrastructure |
| 12 | +• You prefer integrated Windows/Linux development workflows |
19 | 13 |
|
20 | | -## Step 1: Enable WSL on Windows |
| 14 | +What you'll achieve: |
| 15 | +A seamless development setup where you can use Windows tools (VS Code, browsers, file explorers) while running the GenAI IDP accelerator in a native Linux |
| 16 | +environment, ensuring compatibility with AWS Lambda's Linux runtime and deployment targets. |
| 17 | +# Official Microsoft WSL Installation Guide: |
| 18 | +https://docs.microsoft.com/en-us/windows/wsl/install |
21 | 19 |
|
22 | | -### 1.1 Install WSL with Ubuntu |
| 20 | +# Step 1: Enable WSL on Windows |
| 21 | +### 1.1 Enable WSL Feature for example Ubuntu |
23 | 22 | 1. Open PowerShell as Administrator |
24 | 23 | 2. Run the installation command: |
25 | | -```bash |
| 24 | +``` |
26 | 25 | wsl --install -d Ubuntu |
27 | 26 | ``` |
28 | | -3. Complete Ubuntu setup with username/password |
29 | | -4. You will enter into linux shell directly, then go to your WSL home directory using ``` cd ~ ``` |
30 | | - |
31 | | -## Step 2: Clone Repository and Run Setup Script |
32 | | - |
33 | | -### 2.1 Clone Repository |
| 27 | +3. Restart your computer when prompted |
| 28 | +4. Complete Ubuntu setup with username/password |
| 29 | +### 1.2 Verify Installation |
| 30 | +``` |
| 31 | +wsl --version |
| 32 | +``` |
| 33 | +# Step 2: Install Development Tools in WSL |
| 34 | +Open "Ubuntu" in local machine |
| 35 | +### 2.1 Update System Packages |
| 36 | +``` |
| 37 | +sudo apt update && sudo apt upgrade -y |
| 38 | +``` |
| 39 | +### 2.2 Install Essential Tools |
| 40 | +### Install Git |
| 41 | +``` |
| 42 | +sudo apt install git -y |
| 43 | +``` |
| 44 | +# Step 3: Clone and Setup Project |
| 45 | +### Clone Repository |
34 | 46 | ``` |
35 | 47 | git clone https://github.com/aws-solutions-library-samples/accelerated-intelligent-document-processing-on-aws |
36 | 48 | ``` |
| 49 | +### Go to directory |
37 | 50 | ``` |
38 | 51 | cd accelerated-intelligent-document-processing-on-aws |
39 | 52 | ``` |
40 | | - |
41 | | -### 2.2 Run Automated Setup Script |
| 53 | +### Install Python and pip |
42 | 54 | ``` |
43 | | -./scripts/wsl_setup.sh |
| 55 | +sudo apt install python3 python3-pip -y |
44 | 56 | ``` |
45 | | -This script automatically installs: |
46 | | -- Git, Python 3, pip, and build tools |
47 | | -- Node.js 18 |
48 | | -- AWS CLI v2 |
49 | | -- AWS SAM CLI |
50 | | -- Python dependencies (boto3, rich, PyYAML, botocore, ruff, pytest) |
51 | | - |
52 | | -After running the setup script, go to your WSL home directory using ```cd ~``` |
53 | | - |
54 | | -## Step 3: Complete Manual Setup |
55 | | - |
56 | | -### 3.1 Create Python Virtual Environment |
| 57 | +### Verify Python version |
| 58 | +``` |
| 59 | +python3 --version |
| 60 | +``` |
| 61 | +### Create and setup Python Environment |
57 | 62 | ``` |
58 | 63 | python3 -m venv venv |
59 | 64 | source venv/bin/activate |
60 | 65 | ``` |
61 | | - |
62 | | -### 3.2 Install Python Dependencies |
63 | | -```bash |
64 | | -pip install setuptools wheel boto3 rich PyYAML botocore ruff pytest |
| 66 | +### Build tools and make |
| 67 | +``` |
| 68 | +sudo apt install build-essential make -y |
| 69 | +``` |
| 70 | +### Install Node.js for UI development |
| 71 | +``` |
| 72 | +curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - |
| 73 | +``` |
| 74 | +``` |
| 75 | +sudo apt-get install -y nodejs |
| 76 | +``` |
| 77 | +### AWS CLI |
| 78 | +#### Downloads the latest AWS CLI zip file for Linux x86_64 architecture |
| 79 | +``` |
| 80 | +curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscli.zip" |
| 81 | +``` |
| 82 | +#### Unzip aws-cli-linux-x86_64.zip -d |
| 83 | +``` |
| 84 | +unzip awscli.zip |
| 85 | +``` |
| 86 | +#### Installation |
| 87 | +``` |
| 88 | +sudo ./aws/install |
65 | 89 | ``` |
66 | | -### 3.3 Configure AWS CLI |
67 | | -```bash |
68 | | -aws configure |
| 90 | +#### Remove Zip file |
69 | 91 | ``` |
70 | | -Enter your AWS credentials when prompted. Refer to: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html |
| 92 | +rm -rf aws awscli.zip |
| 93 | +``` |
| 94 | +### Verify AWS CLI installation |
| 95 | +``` |
| 96 | +aws --version |
| 97 | +``` |
| 98 | +### AWS SAM CLI |
| 99 | +#### Downloads the latest AWS SAM CLI zip file for Linux x86_64 architecture from GitHub releases |
| 100 | +``` |
| 101 | +wget https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip |
| 102 | +``` |
| 103 | +#### Unzip aws-sam-cli-linux-x86_64.zip -d sam-installation |
| 104 | +``` |
| 105 | +unzip aws-sam-cli-linux-x86_64.zip -d sam-installation |
| 106 | +``` |
| 107 | +#### Installation |
| 108 | +``` |
| 109 | +sudo ./sam-installation/install |
| 110 | +``` |
| 111 | +#### Remove Zip file |
| 112 | +``` |
| 113 | +rm -rf sam-installation aws-sam-cli-linux-x86_64.zip |
| 114 | +``` |
| 115 | +### Verify SAM Installation |
| 116 | +``` |
| 117 | +sam --version |
| 118 | +``` |
| 119 | +### Install package building tools |
| 120 | +``` |
| 121 | +pip install setuptools wheel |
| 122 | +``` |
| 123 | +### Install all dependencies required for python |
| 124 | +``` |
| 125 | +pip install boto3 rich PyYAML botocore |
| 126 | +``` |
| 127 | +### Install development tools |
| 128 | +``` |
| 129 | +pip install ruff pytest |
| 130 | +``` |
| 131 | +### Install IDP common package in development mode |
| 132 | +``` |
| 133 | +pip install -e lib/idp_common_pkg/ |
| 134 | +``` |
| 135 | +# Step 4: AWS Configure |
| 136 | +### Refer this link for AWS configure |
| 137 | +https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html |
71 | 138 |
|
72 | | -## Step 4: Test the Setup |
| 139 | +# Step 5: Run Publish Script |
| 140 | +## Using publish.py (Recommended) |
73 | 141 |
|
74 | | -### 4.1 Verify All Tools |
75 | | -```bash |
76 | | -# Check versions |
77 | | -python3 --version (Example: Python 3.12.3) |
78 | | -aws --version (Example: aws-cli/2.28.26) |
79 | | -sam --version (Example: SAM CLI, version 1.143.0) |
80 | | -node --version (Example: v18.20.8) |
81 | | -npm --version (Example: 10.8.2) |
| 142 | +### Test publish script help |
82 | 143 | ``` |
83 | | -### 4.2 Test Build Process |
| 144 | +python3 publish.py --help |
84 | 145 | ``` |
85 | | -cd accelerated-intelligent-document-processing-on-aws |
| 146 | +### Test build using publish.py |
86 | 147 | ``` |
| 148 | +python3 publish.py bucket_name build-test us-east-1 |
87 | 149 | ``` |
88 | | -# Test publish script help |
89 | | -python3 publish.py --help |
90 | | -
|
91 | | -# Test build (replace with your S3 bucket name) |
92 | | -python3 publish.py your-bucket-name build-test us-east-1 |
| 150 | +### Troubleshooting Build Issues |
| 151 | +If the build fails, use the `--verbose` flag to see detailed error messages: |
93 | 152 | ``` |
94 | | - |
95 | | -### 4.3 Troubleshooting Build Issues |
96 | | -If the build fails, use the `--verbose` flag: |
97 | | -```bash |
98 | | -python3 publish.py your-bucket-name build-test us-east-1 --verbose |
| 153 | +python3 publish.py bucket_name build-test us-east-1 --verbose |
99 | 154 | ``` |
100 | | - |
101 | | -The verbose flag shows: |
| 155 | +The verbose flag will show: |
102 | 156 | - Exact SAM build commands being executed |
103 | 157 | - Complete error output from failed builds |
104 | 158 | - Python version compatibility issues |
105 | 159 | - Missing dependencies or configuration problems |
| 160 | + |
| 161 | +## Using publish.sh (Legacy) |
| 162 | +### Test publish script help |
| 163 | +``` |
| 164 | +./publish.sh --help |
| 165 | +``` |
| 166 | +### Test build using publish.sh |
| 167 | +``` |
| 168 | +./publish.sh bucket_name build-test us-east-1 |
| 169 | +``` |
0 commit comments