AUTOMATIC1111 / stable-diffusion-webui-rembg

Removes backgrounds from pictures. Extension for webui.
MIT License
1.17k stars 173 forks source link

ModuleNotFoundError: No module named 'rembg' #16

Open am576 opened 1 year ago

am576 commented 1 year ago

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'
Industrepreneur commented 1 year ago

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

epictetito commented 1 year ago

Same. Linux Debian 12. AUTOMATIC1111 webui v1.4.0

mattdl-radix commented 1 year ago

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

Biniyamseid commented 11 months ago

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

gillbates commented 10 months ago

same problem here in sd 1.6, any ideas why?

padit69 commented 9 months ago

same. i have using macos 14.1

padit69 commented 9 months ago

` 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 `

check321 commented 9 months ago

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

battester commented 9 months ago

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.

Aciid commented 7 months ago

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.

DING03015 commented 3 months ago

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

Momin9 commented 3 months ago

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.