{"id":28187,"library":"simple-lama-inpainting","title":"Simple Lama Inpainting","description":"A lightweight Python wrapper for LaMa image inpainting, supporting CPU and GPU inference. Current version 0.1.2, updated irregularly on PyPI.","status":"active","version":"0.1.2","language":"python","source_language":"en","source_url":"https://github.com/sanazelyari/simple-lama-inpainting","tags":["image-inpainting","lama","deep-learning","pytorch"],"install":[{"cmd":"pip install simple-lama-inpainting","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for model inference","package":"torch","optional":false},{"reason":"Image handling","package":"pillow","optional":false},{"reason":"Array operations","package":"numpy","optional":false},{"reason":"Image processing (common but not strictly required)","package":"opencv-python","optional":true}],"imports":[{"note":"Old or incorrect path; the top-level import is correct since v0.1.0.","wrong":"from simple_lama_inpainting.simple_lama import SimpleLama","symbol":"SimpleLama","correct":"from simple_lama_inpainting import SimpleLama"}],"quickstart":{"code":"from simple_lama_inpainting import SimpleLama\nfrom PIL import Image\n\nsimple_lama = SimpleLama()\nimage = Image.open('input.png')\nmask = Image.open('mask.png')\nresult = simple_lama(image, mask)\nresult.save('output.png')","lang":"python","description":"Basic usage: load image and mask (both PIL), run inpainting, save result."},"warnings":[{"fix":"pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118 (adjust CUDA version as needed)","message":"The package requires PyTorch (>=1.9) but does not install it automatically. You must install torch separately, with the appropriate CUDA version if using GPU.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Ensure mask is converted to binary (0/255) before passing. Use: mask = mask.point(lambda x: 255 if x > 128 else 0)","message":"The mask must be a binary image (black/white) where white indicates the area to inpaint. Using a non-binary mask may produce incorrect results.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Set LAMA_MODEL_PATH=/path/to/big-lama.pt in your environment to use a local model file.","message":"The package downloads the model weights (~250MB) on first run. If your environment has no internet access, pre-download and set environment variable LAMA_MODEL_PATH.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Install with: pip install simple-lama-inpainting (with hyphens). Then import using underscores: from simple_lama_inpainting import SimpleLama","cause":"Package not installed or misspelled (note hyphens vs underscores).","error":"ModuleNotFoundError: No module named 'simple_lama_inpainting'"},{"fix":"Ensure both model and input are on the same device. Use: simple_lama = SimpleLama(device='cuda') to force GPU inference.","cause":"Model loaded on CPU but input tensor on GPU (or vice versa).","error":"RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same"},{"fix":"Download the model manually from https://github.com/sanazelyari/simple-lama-inpainting/releases and set the path: LAMA_MODEL_PATH=/path/to/big-lama.pt python your_script.py","cause":"Model file not found. The package tries to download it on first use but may fail due to network restrictions.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'big-lama.pt'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}