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.utils.realesrgan_utils' #12

Open
xiaohuimc opened this issue Sep 26, 2023 · 5 comments
Open

Comments

@xiaohuimc
Copy link

xiaohuimc commented Sep 26, 2023

How to solve the import error of "basicsr. utils. realsrgan_utils"

# import sys
# sys.path.append('./CodeFormer/CodeFormer')
import sys


sys.path.append("/root/autodl-tmp/workspace/inswapper/CodeFormer/CodeFormer")
from basicsr.utils.realesrgan_utils import RealESRGANer

import os
import cv2
import torch
import torch.nn.functional as F
from torchvision.transforms.functional import normalize

from basicsr.utils import imwrite, img2tensor, tensor2img
from basicsr.utils.download_util import load_file_from_url
from facelib.utils.face_restoration_helper import FaceRestoreHelper
from facelib.utils.misc import is_gray
from basicsr.archs.rrdbnet_arch import RRDBNet
# from basicsr.utils.realesrgan_utils import RealESRGANer
from basicsr.utils.registry import ARCH_REGISTRY
be **removed in 0.17**. Please don't rely on it. You probably just need to use APIs in torchvision.transforms.functional or in torchvision.transforms.v2.functional.
  warnings.warn(
Traceback (most recent call last):
  File "/root/autodl-tmp/workspace/inswapper/swapper.py", line 243, in <module>
    from restoration import *
  File "/root/autodl-tmp/workspace/inswapper/restoration.py", line 18, in <module>
    from basicsr.utils.realesrgan_utils import RealESRGANer
ModuleNotFoundError: No module named 'basicsr.utils.realesrgan_utils'
@jytou
Copy link

jytou commented Nov 22, 2023

Same error here. Besides, it would be a plus if you could indicate which version of python is preferred for this project.

@jndietz
Copy link

jndietz commented Jan 2, 2024

I just ran into this issue today. I resolved it by erasing my venv and re-doing the install steps in the README.md.

@jndietz
Copy link

jndietz commented Jan 4, 2024

Well, I ran into this again, and tried to remove the venv folder, but I'm still getting the error.

In my case, it's a conflict between the parent and child projects. I'm integrating inswapper into Fooocus, and I had to run pip uninstall basicsr and then it seemed to work again.

@machineminded
Copy link

I worked around this by copying the folders from the repo into the venv's libraries folder.

@ashleykleynhans
Copy link
Contributor

This is part of CodeFormer.
If you are getting this error, it means you didn't follow the instructions correctly to install CodeFormer.

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

5 participants