Skip to content

Commit 6ebabc6

Browse files
committed
feat(setup): add automatic poppler-utils detection and installation
- Add poppler-utils check to setup_environment.sh script - Add poppler-utils check to Jupyter notebook prerequisites - Offer automatic installation with user confirmation - Support Ubuntu/Debian (apt-get) and macOS (brew) - Provide clear installation instructions for all platforms - Detect OS and use appropriate package manager This ensures developers are aware of the poppler-utils requirement and can install it automatically during setup, reducing friction for PDF document processing functionality.
1 parent 784cac6 commit 6ebabc6

2 files changed

Lines changed: 128 additions & 0 deletions

File tree

β€Žnotebooks/setup/complete_setup_guide.ipynbβ€Ž

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,81 @@
164164
" ok, version, msg = False, None, \"❌ docker compose is not available\"\n",
165165
"print(msg)\n",
166166
"\n",
167+
"# Check poppler-utils (required for PDF document processing)\n",
168+
"print(\"\\n\" + \"=\" * 60)\n",
169+
"print(\"πŸ“„ Checking system dependencies for document processing...\")\n",
170+
"ok, version, msg = check_command('pdfinfo')\n",
171+
"if ok:\n",
172+
" print(f\"βœ… {msg}\")\n",
173+
"else:\n",
174+
" print(f\"⚠️ {msg}\")\n",
175+
" print(\" poppler-utils is required for PDF document processing\")\n",
176+
" \n",
177+
" # Detect OS and provide installation instructions\n",
178+
" import platform\n",
179+
" system = platform.system().lower()\n",
180+
" \n",
181+
" if system == 'linux':\n",
182+
" print(\" πŸ’‘ To install on Ubuntu/Debian: sudo apt-get install poppler-utils\")\n",
183+
" print(\" πŸ’‘ To install on RHEL/CentOS: sudo yum install poppler-utils\")\n",
184+
" print(\" πŸ’‘ To install on Fedora: sudo dnf install poppler-utils\")\n",
185+
" \n",
186+
" # Try to detect package manager and offer automatic installation\n",
187+
" if shutil.which('apt-get'):\n",
188+
" try:\n",
189+
" install = input(\"\\n❓ Would you like to install poppler-utils now? (requires sudo) [y/N]: \").strip().lower()\n",
190+
" if install == 'y':\n",
191+
" print(\"πŸ“¦ Installing poppler-utils...\")\n",
192+
" result = subprocess.run(\n",
193+
" ['sudo', 'apt-get', 'update'],\n",
194+
" capture_output=True,\n",
195+
" text=True,\n",
196+
" timeout=60\n",
197+
" )\n",
198+
" if result.returncode == 0:\n",
199+
" result = subprocess.run(\n",
200+
" ['sudo', 'apt-get', 'install', '-y', 'poppler-utils'],\n",
201+
" capture_output=True,\n",
202+
" text=True,\n",
203+
" timeout=120\n",
204+
" )\n",
205+
" if result.returncode == 0:\n",
206+
" print(\"βœ… poppler-utils installed successfully\")\n",
207+
" else:\n",
208+
" print(f\"❌ Installation failed: {result.stderr}\")\n",
209+
" else:\n",
210+
" print(f\"❌ Failed to update package list: {result.stderr}\")\n",
211+
" except (KeyboardInterrupt, EOFError):\n",
212+
" print(\"\\n⏭️ Skipping installation\")\n",
213+
" except Exception as e:\n",
214+
" print(f\"⚠️ Could not install automatically: {e}\")\n",
215+
" print(\" Please install manually: sudo apt-get install poppler-utils\")\n",
216+
" elif system == 'darwin': # macOS\n",
217+
" print(\" πŸ’‘ To install on macOS: brew install poppler\")\n",
218+
" if shutil.which('brew'):\n",
219+
" try:\n",
220+
" install = input(\"\\n❓ Would you like to install poppler now? [y/N]: \").strip().lower()\n",
221+
" if install == 'y':\n",
222+
" print(\"πŸ“¦ Installing poppler...\")\n",
223+
" result = subprocess.run(\n",
224+
" ['brew', 'install', 'poppler'],\n",
225+
" capture_output=True,\n",
226+
" text=True,\n",
227+
" timeout=300\n",
228+
" )\n",
229+
" if result.returncode == 0:\n",
230+
" print(\"βœ… poppler installed successfully\")\n",
231+
" else:\n",
232+
" print(f\"❌ Installation failed: {result.stderr}\")\n",
233+
" except (KeyboardInterrupt, EOFError):\n",
234+
" print(\"\\n⏭️ Skipping installation\")\n",
235+
" except Exception as e:\n",
236+
" print(f\"⚠️ Could not install automatically: {e}\")\n",
237+
" print(\" Please install manually: brew install poppler\")\n",
238+
" else:\n",
239+
" print(\" πŸ’‘ Please install poppler-utils using your system's package manager\")\n",
240+
" print(\" πŸ’‘ Windows: Download from http://blog.alivate.com.au/poppler-windows/\")\n",
241+
"\n",
167242
"print(\"\\n\" + \"=\" * 60)\n",
168243
"print(\"\\nβœ… Prerequisites check complete!\")\n",
169244
"print(\"\\nπŸ“ If any checks failed, please install the missing tools before proceeding.\")\n"

β€Žscripts/setup/setup_environment.shβ€Ž

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,59 @@ else
6363
echo "βœ… Found npm $NPM_VERSION"
6464
fi
6565

66+
# Check for poppler-utils (required for PDF document processing)
67+
echo ""
68+
echo "πŸ” Checking for system dependencies..."
69+
if ! command -v pdfinfo &> /dev/null; then
70+
echo "⚠️ poppler-utils is not installed (required for PDF document processing)"
71+
72+
# Detect OS and provide installation instructions
73+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
74+
# Linux - check if we can use apt-get
75+
if command -v apt-get &> /dev/null; then
76+
echo "πŸ’‘ To install poppler-utils, run: sudo apt-get install poppler-utils"
77+
read -p "❓ Would you like to install poppler-utils now? (requires sudo) [y/N]: " -n 1 -r
78+
echo
79+
if [[ $REPLY =~ ^[Yy]$ ]]; then
80+
echo "πŸ“¦ Installing poppler-utils..."
81+
sudo apt-get update && sudo apt-get install -y poppler-utils
82+
echo "βœ… poppler-utils installed"
83+
else
84+
echo "⚠️ Skipping poppler-utils installation. You can install it later with: sudo apt-get install poppler-utils"
85+
fi
86+
elif command -v yum &> /dev/null; then
87+
echo "πŸ’‘ To install poppler-utils, run: sudo yum install poppler-utils"
88+
elif command -v dnf &> /dev/null; then
89+
echo "πŸ’‘ To install poppler-utils, run: sudo dnf install poppler-utils"
90+
else
91+
echo "πŸ’‘ Please install poppler-utils using your system's package manager"
92+
fi
93+
elif [[ "$OSTYPE" == "darwin"* ]]; then
94+
# macOS
95+
if command -v brew &> /dev/null; then
96+
echo "πŸ’‘ To install poppler, run: brew install poppler"
97+
read -p "❓ Would you like to install poppler now? [y/N]: " -n 1 -r
98+
echo
99+
if [[ $REPLY =~ ^[Yy]$ ]]; then
100+
echo "πŸ“¦ Installing poppler..."
101+
brew install poppler
102+
echo "βœ… poppler installed"
103+
else
104+
echo "⚠️ Skipping poppler installation. You can install it later with: brew install poppler"
105+
fi
106+
else
107+
echo "πŸ’‘ Please install Homebrew first, then run: brew install poppler"
108+
fi
109+
else
110+
echo "πŸ’‘ Please install poppler-utils using your system's package manager"
111+
echo " Ubuntu/Debian: sudo apt-get install poppler-utils"
112+
echo " macOS: brew install poppler"
113+
echo " Windows: Download from http://blog.alivate.com.au/poppler-windows/"
114+
fi
115+
else
116+
echo "βœ… poppler-utils is installed ($(pdfinfo --version 2>/dev/null | head -n1 || echo 'version unknown'))"
117+
fi
118+
66119
# Create virtual environment if it doesn't exist
67120
if [ ! -d "env" ]; then
68121
echo "πŸ“¦ Creating virtual environment..."

0 commit comments

Comments
Β (0)