Skip to content

armgit / rembg

Public Imported from GitHub
0

Rembg is a tool to remove images background

Fix Windows installer missing Python modules (#822)

Daniel Gatis932210450872
diff --git a/_build-exe.ps1 b/_build-exe.ps1
index bb1c41e..8520331 100755
--- a/_build-exe.ps1
+++ b/_build-exe.ps1
@@ -3,18 +3,17 @@ if (-not (Get-Command poetry -ErrorAction SilentlyContinue)) {
pip install poetry
}
-# Install pyinstaller
-pip install pyinstaller
-
# Build CPU version
Write-Host "Building CPU version..." -ForegroundColor Cyan
poetry install --extras "cli cpu"
+poetry run pip install pyinstaller
poetry run pyinstaller rembg.spec
Rename-Item -Path "dist/rembg" -NewName "rembg-cpu"
# Build GPU version
Write-Host "Building GPU version..." -ForegroundColor Cyan
poetry install --extras "cli gpu"
+poetry run pip install pyinstaller
poetry run pyinstaller rembg.spec --noconfirm
Rename-Item -Path "dist/rembg" -NewName "rembg-gpu"
diff --git a/rembg.spec b/rembg.spec
index 7cce928..b388d90 100644
--- a/rembg.spec
+++ b/rembg.spec
@@ -23,7 +23,36 @@ a = Analysis(
pathex=[],
binaries=binaries,
datas=datas,
- hiddenimports=[],
+ hiddenimports=[
+ # Core dependencies
+ 'numpy',
+ 'PIL',
+ 'scipy',
+ 'scipy.ndimage',
+ 'skimage',
+ 'skimage.morphology',
+ 'pymatting',
+ 'pymatting.alpha',
+ 'pymatting.foreground',
+ 'pymatting.util',
+ 'tqdm',
+ 'pooch',
+ 'jsonschema',
+ 'onnxruntime',
+ # CLI dependencies
+ 'click',
+ 'uvicorn',
+ 'fastapi',
+ 'starlette',
+ 'starlette.responses',
+ 'aiohttp',
+ 'asyncer',
+ 'filetype',
+ 'gradio',
+ 'watchdog',
+ 'sniffio',
+ 'multipart',
+ ],
hookspath=[],
hooksconfig={},
runtime_hooks=[],