haofanwang / inswapper

One-click Face Swapper and Restoration powered by insightface 🔥
486 stars 72 forks source link

ModuleNotFoundError: No module named 'facelib.utils' #8

Open usamaa-saleem opened 1 year ago

usamaa-saleem commented 1 year ago

I did import the codeformer as well and did everything as require, but still getting this error.

Traceback (most recent call last): File "swapper.py", line 228, in <module> from restoration import * File "/home/ubuntu/inswapper/restoration.py", line 12, in <module> from facelib.utils.face_restoration_helper import FaceRestoreHelper ModuleNotFoundError: No module named 'facelib.utils'

haofanwang commented 1 year ago

The facelib is inside CodeFormer. So first you need to git clone as instruction below and install libraries required by Codeformer.

git lfs install
git clone https://huggingface.co/spaces/sczhou/CodeFormer

and add the dir into your path, then you can import it.

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

@usamaa-saleem Hope this helps.

wly-ai-bj commented 6 months ago

I did import the codeformer as well and did everything as require, but still getting this error.

Traceback (most recent call last): File "swapper.py", line 228, in <module> from restoration import * File "/home/ubuntu/inswapper/restoration.py", line 12, in <module> from facelib.utils.face_restoration_helper import FaceRestoreHelper ModuleNotFoundError: No module named 'facelib.utils'

I met the same error, do you solve it???

usamaa-saleem commented 6 months ago

Yes, https://github.com/haofanwang/inswapper/issues/8#issuecomment-1690916472 this helped.

wly-ai-bj commented 6 months ago

Yes, #8 (comment) this helped.

I command as follows: first, clone CodeFormer in the directory out of inswapper;

git lfs install
git clone https://huggingface.co/spaces/sczhou/CodeFormer

Then, in the file of restoration.py ,add the code as follow:

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

But , I still meth the error: "No module named 'facelib.utils'"

So, do you make any other operations??

usamaa-saleem commented 6 months ago

Try installing opencv-python==4.6.0.66

wly-ai-bj commented 6 months ago

Try installing opencv-python==4.6.0.66

The same error. Too strange!!!

ashleykleynhans commented 6 months ago

Yes, #8 (comment) this helped.

I command as follows: first, clone CodeFormer in the directory out of inswapper;

git lfs install
git clone https://huggingface.co/spaces/sczhou/CodeFormer

Which operating system is this? Was the git lfs install command actually successful? Usually it requires the git-lfs package to be installed in your Operating System.

On Ubuntu Linux:

sudo apt update
sudo apt -y install git-lfs

On Mac:

brew install git-lfs
wly-ai-bj commented 6 months ago

Yes, #8 (comment) this helped.

I command as follows: first, clone CodeFormer in the directory out of inswapper;

git lfs install
git clone https://huggingface.co/spaces/sczhou/CodeFormer

Which operating system is this? Was the git lfs install command actually successful? Usually it requires the git-lfs package to be installed in your Operating System.

On Ubuntu Linux:

sudo apt update
sudo apt -y install git-lfs

On Mac:

brew install git-lfs

Thank you!!