stable-diffusion-webui-rembg icon indicating copy to clipboard operation
stable-diffusion-webui-rembg copied to clipboard

ModuleNotFoundError: No module named 'rembg'

Open am576 opened this issue 2 years ago • 11 comments

I have just discovered this script. And after installing it on the fresh web-ui and enabling it in the Extensions tab I got this error

Restarting UI...
Error loading script: postprocessing_rembg.py
Traceback (most recent call last):
  File "C:\stable-diffusion-webui\modules\scripts.py", line 256, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "C:\stable-diffusion-webui\modules\script_loading.py", line 11, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\stable-diffusion-webui\extensions\stable-diffusion-webui-rembg\scripts\postprocessing_rembg.py", line 5, in <module>
    import rembg
ModuleNotFoundError: No module named 'rembg'

am576 avatar Apr 19 '23 22:04 am576

Same. Added to colab+ using extension tab, but hit this error.

Industrepreneur avatar Apr 23 '23 20:04 Industrepreneur

Same. Linux Debian 12. AUTOMATIC1111 webui v1.4.0

epictetito avatar Jul 01 '23 12:07 epictetito

Same, with preceding error:

ERROR: Could not find a version that satisfies the requirement rembg==2.0.38 (from versions: 2.0.41, 2.0.43, 2.0.44, 2.0.45, 2.0.46, 2.0.47, 2.0.48, 2.0.49)
ERROR: No matching distribution found for rembg==2.0.38

I think the problem comes from line pip install rembg==2.0.38 --no-deps --prefer-binary in the install.py that has no matching version. You can change the line in the script to a matching version, e.g. rembg==2.0.41

mattdl-radix avatar Jul 06 '23 13:07 mattdl-radix

same. I have tried to use it in my streamlit app, but got this error.

Biniyamseid avatar Sep 13 '23 22:09 Biniyamseid

same problem here in sd 1.6, any ideas why?

gillbates avatar Nov 04 '23 16:11 gillbates

same. i have using macos 14.1

padit69 avatar Nov 15 '23 04:11 padit69

` stable-diffusion-webui % rembg --help Usage: rembg [OPTIONS] COMMAND [ARGS]...

Options: --version Show the version and exit. --help Show this message and exit.

Commands: b for a byte stream as input i for a file as input p for a folder as input s for a http server `

padit69 avatar Nov 15 '23 04:11 padit69

Same, with preceding error:

ERROR: Could not find a version that satisfies the requirement rembg==2.0.38 (from versions: 2.0.41, 2.0.43, 2.0.44, 2.0.45, 2.0.46, 2.0.47, 2.0.48, 2.0.49)
ERROR: No matching distribution found for rembg==2.0.38

I think the problem comes from line pip install rembg==2.0.38 --no-deps --prefer-binary in the install.py that has no matching version. You can change the line in the script to a matching version, e.g. rembg==2.0.41

thx,that works for me

check321 avatar Nov 27 '23 04:11 check321

I met this but I solved it by changing the rembg version in the install.py from 2.0.38 to 2.0.52, bcz when I run the webui script, it showed “ERROR: No matching distribution found for rembg==2.0.38”, so I go to pycharm to check if any version avaliable and then found the 2.0.52 version. So I fix the version in install.py and then rerun the webui.sh, problem solved.

battester avatar Dec 04 '23 07:12 battester

Open powershell run the following command to activate automatic/A1111 virtualenv, modify path if needed.

C:\automatic\venv\Scripts\Activate.ps1

Run the following to confirm no version of rembg is installed

pip index versions rembg

(venv) PS C:\Windows\System32\WindowsPowerShell\v1.0> pip index versions rembg
WARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.
rembg (2.0.54)
Available versions: 2.0.54, 2.0.53, 2.0.52, 2.0.51, 2.0.50, 2.0.49, 2.0.48, 2.0.47, 2.0.46, 2.0.45, 2.0.44, 2.0.43, 2.0.41, 2.0.40, 2.0.39, 2.0.38, 2.0.37, 2.0.36, 2.0.35, 2.0.34, 2.0.33, 2.0.32, 2.0.31, 2.0.30, 2.0.29, 2.0.28

Run the following to install the latest version of rembg

pip install rembg==2.0.54 --no-deps --prefer-binary

(venv) PS C:\Windows\System32\WindowsPowerShell\v1.0> pip install rembg==2.0.54  --no-deps --prefer-binary
Collecting rembg==2.0.54
  Downloading rembg-2.0.54-py3-none-any.whl (32 kB)
Installing collected packages: rembg
Successfully installed rembg-2.0.54

[notice] A new release of pip available: 22.2.1 -> 23.3.2
[notice] To update, run: python.exe -m pip install --upgrade pip
(venv) PS C:\Windows\System32\WindowsPowerShell\v1.0>

Start SD.Next/automatic/A1111 using webui.ps1, go to control, upload picture, select rembg mode and click generate. It works now

Have a good one, cheers.

Aciid avatar Feb 08 '24 09:02 Aciid

Open powershell run the following command to activate automatic/A1111 virtualenv, modify path if needed.

C:\automatic\venv\Scripts\Activate.ps1

Run the following to confirm no version of rembg is installed

pip index versions rembg

(venv) PS C:\Windows\System32\WindowsPowerShell\v1.0> pip index versions rembg
WARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.
rembg (2.0.54)
Available versions: 2.0.54, 2.0.53, 2.0.52, 2.0.51, 2.0.50, 2.0.49, 2.0.48, 2.0.47, 2.0.46, 2.0.45, 2.0.44, 2.0.43, 2.0.41, 2.0.40, 2.0.39, 2.0.38, 2.0.37, 2.0.36, 2.0.35, 2.0.34, 2.0.33, 2.0.32, 2.0.31, 2.0.30, 2.0.29, 2.0.28

Run the following to install the latest version of rembg

pip install rembg==2.0.54 --no-deps --prefer-binary

(venv) PS C:\Windows\System32\WindowsPowerShell\v1.0> pip install rembg==2.0.54  --no-deps --prefer-binary
Collecting rembg==2.0.54
  Downloading rembg-2.0.54-py3-none-any.whl (32 kB)
Installing collected packages: rembg
Successfully installed rembg-2.0.54

[notice] A new release of pip available: 22.2.1 -> 23.3.2
[notice] To update, run: python.exe -m pip install --upgrade pip
(venv) PS C:\Windows\System32\WindowsPowerShell\v1.0>

Start SD.Next/automatic/A1111 using webui.ps1, go to control, upload picture, select rembg mode and click generate. It works now

Have a good one, cheers.

I performed these two steps and other problems occurred Error occurred when executing Image Rembg (Remove Background): No module named 'pymatting' I want to ask what I should do next

DING03015 avatar May 20 '24 08:05 DING03015

It seems that there's an error loading the script postprocessing_rembg.py due to a missing module named rembg.

To resolve this issue, you need to install the rembg module. You can do this using pip, the Python package manager, by running the following command in your terminal or command prompt:

**pip install rembg**

This command will download and install the rembg module along with its dependencies. After the installation is complete, you should be able to load the script postprocessing_rembg.py without encountering the ModuleNotFoundError.

Momin9 avatar Jun 05 '24 10:06 Momin9