|
1 | | -# Development Environment Setup Guide on Windows using WSL(Windows Subsystem for Linux) |
2 | | -# Introduction |
| 1 | +# Development Environment Setup Guide on Windows using WSL |
| 2 | + |
| 3 | +## Introduction |
3 | 4 | This guide establishes a WSL-based development environment on Windows, specifically designed for the GenAI IDP accelerator. |
4 | 5 |
|
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. |
| 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. |
7 | 15 |
|
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 |
| 16 | +## Prerequisites |
13 | 17 |
|
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 |
| 18 | +**Official Microsoft WSL Installation Guide**: https://docs.microsoft.com/en-us/windows/wsl/install |
19 | 19 |
|
20 | | -# Step 1: Enable WSL on Windows |
21 | | -### 1.1 Enable WSL Feature for example Ubuntu |
| 20 | +## Step 1: Enable WSL on Windows |
| 21 | + |
| 22 | +### 1.1 Install WSL with Ubuntu |
22 | 23 | 1. Open PowerShell as Administrator |
23 | 24 | 2. Run the installation command: |
24 | | -``` |
| 25 | +```bash |
25 | 26 | wsl --install -d Ubuntu |
26 | 27 | ``` |
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 |
| 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 |
46 | 34 | ``` |
47 | 35 | git clone https://github.com/aws-solutions-library-samples/accelerated-intelligent-document-processing-on-aws |
48 | 36 | ``` |
49 | | -### Go to directory |
50 | 37 | ``` |
51 | 38 | cd accelerated-intelligent-document-processing-on-aws |
52 | 39 | ``` |
53 | | -### Install Python and pip |
54 | | -``` |
55 | | -sudo apt install python3 python3-pip -y |
56 | | -``` |
57 | | -### Verify Python version |
| 40 | + |
| 41 | +### 2.2 Run Automated Setup Script |
58 | 42 | ``` |
59 | | -python3 --version |
| 43 | +./scripts/wsl_setup.sh |
60 | 44 | ``` |
61 | | -### Create and setup Python Environment |
| 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 |
| 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 |
62 | 57 | ``` |
63 | 58 | python3 -m venv venv |
64 | 59 | source venv/bin/activate |
65 | 60 | ``` |
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 |
89 | | -``` |
90 | | -#### Remove Zip file |
91 | | -``` |
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 |
| 61 | + |
| 62 | +### 3.2 Install Python Dependencies |
| 63 | +```bash |
| 64 | +pip install setuptools wheel boto3 rich PyYAML botocore ruff pytest typer |
132 | 65 | ``` |
133 | | -pip install -e lib/idp_common_pkg/ |
| 66 | +### 3.3 Configure AWS CLI |
| 67 | +```bash |
| 68 | +aws configure |
134 | 69 | ``` |
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 |
| 70 | +Enter your AWS credentials when prompted. Refer to: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html |
138 | 71 |
|
139 | | -# Step 5: Run Publish Script |
140 | | -## Using publish.py (Recommended) |
| 72 | +## Step 4: Test the Setup |
141 | 73 |
|
142 | | -### Test publish script help |
| 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) |
143 | 82 | ``` |
144 | | -python3 publish.py --help |
| 83 | +### 4.2 Test Build Process |
145 | 84 | ``` |
146 | | -### Test build using publish.py |
| 85 | +cd accelerated-intelligent-document-processing-on-aws |
147 | 86 | ``` |
148 | | -python3 publish.py bucket_name build-test us-east-1 |
149 | 87 | ``` |
150 | | -### Troubleshooting Build Issues |
151 | | -If the build fails, use the `--verbose` flag to see detailed error messages: |
| 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 |
152 | 93 | ``` |
153 | | -python3 publish.py bucket_name build-test us-east-1 --verbose |
| 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 |
154 | 99 | ``` |
155 | | -The verbose flag will show: |
| 100 | + |
| 101 | +The verbose flag shows: |
156 | 102 | - Exact SAM build commands being executed |
157 | 103 | - Complete error output from failed builds |
158 | 104 | - Python version compatibility issues |
159 | 105 | - Missing dependencies or configuration problems |
160 | 106 |
|
161 | | -## Using publish.sh (Legacy) |
162 | | -### Test publish script help |
163 | | -``` |
164 | | -./publish.sh --help |
165 | | -``` |
166 | | -### Test build using publish.sh |
| 107 | +## Step 5: Install Visual Studio Code on Local Machine for using WSL as a terminal |
| 108 | +### Visit the official website: Go to [https://code.visualstudio.com/](https://code.visualstudio.com/) |
| 109 | +Download: Click the "Download for Windows" button |
| 110 | +- This will download the User Installer (recommended for most users) |
| 111 | +- File name will be something like VSCodeUserSetup-x64-1.x.x.exe |
| 112 | + |
| 113 | +Install: |
| 114 | + - Run the downloaded installer |
| 115 | + - Choose installation location (default is recommended) |
| 116 | + |
| 117 | +Launch: Click "Launch Visual Studio Code" when installation completes |
| 118 | + |
| 119 | +### Install VSCode Extensions |
| 120 | +Install **WSL** extension |
| 121 | + |
| 122 | +### Open Project in WSL |
| 123 | +From WSL terminal, navigate to project and open in VSCode |
167 | 124 | ``` |
168 | | -./publish.sh bucket_name build-test us-east-1 |
| 125 | +cd accelerated-intelligent-document-processing-on-aws |
169 | 126 | ``` |
0 commit comments