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

ImportError: cannot import name 'packaging' from 'pkg_resources' #244

Open
anastalaz opened this issue May 30, 2024 · 4 comments
Open

ImportError: cannot import name 'packaging' from 'pkg_resources' #244

anastalaz opened this issue May 30, 2024 · 4 comments

Comments

@anastalaz
Copy link

Trying to run inference.py I get following error:

Traceback (most recent call last):
File "inference.py", line 16, in
from third_part.GPEN.gpen_face_enhancer import FaceEnhancement
File "/home/anastalaz/dev/video-retalking/third_part/GPEN/gpen_face_enhancer.py", line 8, in
from face_model.face_gan import FaceGAN
File "/home/anastalaz/dev/video-retalking/third_part/GPEN/face_model/face_gan.py", line 13, in
from face_model.gpen_model import FullGenerator
File "/home/anastalaz/dev/video-retalking/third_part/GPEN/face_model/gpen_model.py", line 16, in
from face_model.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d
File "/home/anastalaz/dev/video-retalking/third_part/GPEN/face_model/op/init.py", line 1, in
from .fused_act import FusedLeakyReLU, fused_leaky_relu
File "/home/anastalaz/dev/video-retalking/third_part/GPEN/face_model/op/fused_act.py", line 8, in
from torch.utils.cpp_extension import load, _import_module_from_library
File "/home/anastalaz/miniconda3/envs/video_retalking/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 23, in
from pkg_resources import packaging # type: ignore[attr-defined]
ImportError: cannot import name 'packaging' from 'pkg_resources'

Anyone knows what to do?

@tom20180101
Copy link

try uninstall setuptools and install setuptools==69.5.1

@ashwani-ver
Copy link

try uninstall setuptools and install setuptools==69.5.1

Hey,
I installed the version you told. but i am facing one issue.
After I hit the inference command, nothing is coming, it is stuck at that point. command is not executing and also not throwing any error.
How can i solve this?
thank you

@ashwani-ver
Copy link

I solved the problem with 2 steps.
1.Go to file /usr/local/lib/python3.10/dist-packages/basicsr/data/degradations.py and change line number 8 to:

from torchvision.transforms.functional import rgb_to_grayscale
Got the solution from AUTOMATIC1111/stable-diffusion-webui#13985

  1. use python version 3.10.12 for creating environment instead of 3.8. For me it worked.

@tom20180101
Copy link

tom20180101 commented Jun 11, 2024

I solved the problem with 2 steps. 1.Go to file /usr/local/lib/python3.10/dist-packages/basicsr/data/degradations.py and change line number 8 to:

from torchvision.transforms.functional import rgb_to_grayscale Got the solution from AUTOMATIC1111/stable-diffusion-webui#13985

  1. use python version 3.10.12 for creating environment instead of 3.8. For me it worked.

in my server ,i use python 3.8 ,uninstall setuptools and install setuptools==69.5.1 ,then it worked. :)

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

3 participants