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 'basicsr.losses.losses' #383

Closed
ReinerBforartists opened this issue Sep 13, 2022 · 9 comments
Closed
Labels
asking-for-help-with-local-system-issues This issue is asking for help related to local system; please offer assistance

Comments

@ReinerBforartists
Copy link

Describe the bug
After updating the repo and running the webui,bat i got an error while setting up gfpgan.

ModuleNotFoundError: No module named 'basicsr.losses.losses'

repo

Running it again though then worked. I nevertheless thought it is worth a report. Maybe you want to have a look at the code there.

working

@ReinerBforartists ReinerBforartists added the bug Report of a confirmed bug label Sep 13, 2022
@GalaxyTimeMachine
Copy link

Exactly the same for me after latest pull.

@PhreakHeaven
Copy link

The instructions now state to run 'webui-user.bat' instead. Not sure if that made a difference, but it did actually download/update GFPGAN and basicsr when I closed the terminal and ran that instead, with no errors this time.

@hyphenized
Copy link

Changed basicsr to basicsr==1.4.2 in requirements_versions.txt and it seems to be working fine. This might break other stuff though.

@an0maly33
Copy link

an0maly33 commented Sep 14, 2022

Tried 1.3.5 and 1.4.2. Getting this error with both as of my latest pull.

Launching with webui-user.bat

@djdookie
Copy link

When starting webui-user.bat I get the same error message with the latest master branch pull:

ModuleNotFoundError: No module named 'basicsr.losses.gan_loss'

@stormsson
Copy link

stormsson commented Sep 15, 2022

I confirm i have the same situation , even after multiple restarts

ModuleNotFoundError: No module named 'basicsr.losses.gan_loss'

@djdookie
Copy link

djdookie commented Sep 15, 2022

We recently got a downgrade commit for basicsr to v1.3.5 here.
6e68cc8

But it shouldn't be solved with this, because gfpgan and realesrgan seem to need basicsr >= v1.4.2.

pip install basicsr==1.3.5

Installing collected packages: basicsr Attempting uninstall: basicsr Found existing installation: basicsr 1.4.2 Uninstalling basicsr-1.4.2: Successfully uninstalled basicsr-1.4.2 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. gfpgan 1.3.5 requires basicsr>=1.4.2, but you have basicsr 1.3.5 which is incompatible. realesrgan 0.2.5.0 requires basicsr>=1.4.2, but you have basicsr 1.3.5 which is incompatible. Successfully installed basicsr-1.3.5

Please fix this bug, because GFPGAN is not working in this repo right now. At least for some people.
I wonder why it's working fine in other rops like https://github.com/sd-webui/stable-diffusion-webui

@djdookie
Copy link

djdookie commented Sep 16, 2022

Ok I did a deep dive.

This broke it: TencentARC/GFPGAN@7d657f2
coming from this PR TencentARC/GFPGAN#210
A revert like this helps using GFPGAN again: AdamBear/GFPGAN@8ef599d

TL;DR: Hotfix this by opening .\venv\Lib\site-packages\gfpgan\models\gfpgan_model.py
and replace from basicsr.losses.gan_loss import r1_penalty
with from basicsr.losses.losses import r1_penalty

@djdookie
Copy link

djdookie commented Sep 16, 2022

Under Windows if you use the web-user.bat to start you can remove or rename the venv folder, set these versions in the requirements_versions.txt:

basicsr==1.4.2
gfpgan==1.3.8

Then call web-user.bat. This will create the local venv with compatible versions without the mentioned bug if you didn't define any VENV_DIR in the web-user.bat.
Directly calling python launch.py should work too.

Not setting the explcit gfpgan version also worked for me after removing the venv directory.

@dfaker dfaker added asking-for-help-with-local-system-issues This issue is asking for help related to local system; please offer assistance and removed bug Report of a confirmed bug labels Sep 27, 2022
@dfaker dfaker closed this as completed Sep 27, 2022
lshqqytiger referenced this issue in lshqqytiger/stable-diffusion-webui-amdgpu Apr 23, 2023
Add "None" option to extra networks dropdowns
nne998 pushed a commit to fjteam/stable-diffusion-webui that referenced this issue Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
asking-for-help-with-local-system-issues This issue is asking for help related to local system; please offer assistance
Projects
None yet
Development

No branches or pull requests

8 participants