Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'rembg' #16

Open
am576 opened this issue Apr 19, 2023 · 11 comments
Open

ModuleNotFoundError: No module named 'rembg' #16

am576 opened this issue Apr 19, 2023 · 11 comments

Comments

@am576
Copy link

am576 commented Apr 19, 2023

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
Copy link

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

@epictetito
Copy link

Same. Linux Debian 12. AUTOMATIC1111 webui v1.4.0

@mattdl-radix
Copy link

mattdl-radix commented Jul 6, 2023

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
Copy link

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

@gillbates
Copy link

same problem here in sd 1.6, any ideas why?

@padit69
Copy link

padit69 commented Nov 15, 2023

same. i have using macos 14.1

@padit69
Copy link

padit69 commented Nov 15, 2023

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

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
Copy link

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
Copy link

Aciid commented Feb 8, 2024

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
Copy link

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
Copy link

Momin9 commented Jun 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests