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

Import Failed #5

Open
tiago-falves opened this issue Apr 16, 2024 · 5 comments
Open

Import Failed #5

tiago-falves opened this issue Apr 16, 2024 · 5 comments

Comments

@tiago-falves
Copy link

Good morning,
I have been trying to install this extension, but it always gives me the Import failed error.
All other extensions are working fine, and I have inclusively installed all dependencies using requiremnts.txt
image
image
Anyone else got the same problem? Would appreciate some help!
@meap158

@creamlabsAI
Copy link

Me too . Same would love to find a solution for this
Bildschirmfoto 2024-04-19 um 13 51 10

@ModzhaHead
Copy link

File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement_init_.py", line 8, in
from .background_replacement import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement\background_replacement.py", line 11, in
from .image_utils import ensure_resolution
File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement\image_utils.py", line 4, in
from .upscaler import upscale
File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement\upscaler.py", line 4, in
from realesrgan import RealESRGANer
File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\realesrgan_init_.py", line 2, in
from .archs import *
File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\realesrgan\archs_init_.py", line 2, in
from basicsr.utils import scandir
File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr_init_.py", line 4, in
from .data import *
File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\data_init_.py", line 22, in
dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames]
File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\data_init
.py", line 22, in
dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames]
File "importlib_init
.py", line 126, in import_module
File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\data\realesrgan_dataset.py", line 11, in
from basicsr.data.degradations import circular_lowpass_kernel, random_mixed_kernels
File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\data\degradations.py", line 8, in
from torchvision.transforms.functional_tensor import rgb_to_grayscale
ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'

Cannot import C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement module for custom nodes: No module named 'torchvision.transforms.functional_tensor'

(IMPORT FAILED): C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement

@ModzhaHead
Copy link

File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement__init__.py", line 8, in from .background_replacement import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement\background_replacement.py", line 11, in from .image_utils import ensure_resolution File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement\image_utils.py", line 4, in from .upscaler import upscale File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement\upscaler.py", line 4, in from realesrgan import RealESRGANer File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\realesrgan__init__.py", line 2, in from .archs import * File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\realesrgan\archs__init__.py", line 2, in from basicsr.utils import scandir File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr__init__.py", line 4, in from .data import * File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\data__init__.py", line 22, in dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames] File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\data__init_.py", line 22, in dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames] File "importlib__init_.py", line 126, in import_module File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\data\realesrgan_dataset.py", line 11, in from basicsr.data.degradations import circular_lowpass_kernel, random_mixed_kernels File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\data\degradations.py", line 8, in from torchvision.transforms.functional_tensor import rgb_to_grayscale ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'

Cannot import C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement module for custom nodes: No module named 'torchvision.transforms.functional_tensor'

(IMPORT FAILED): C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement

After googling a bit, I found and took the advice from this link:
AUTOMATIC1111/stable-diffusion-webui#13985 (comment)

After I did this, when ComfyUI was launched, several modules were downloaded and updated, and everything seemed to work. In fact, this is a rather complex and non-obvious solution to problems with installing only two nodes, so it would be great if the developer made corrections to his code.

@Bortus-AI
Copy link

File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement__init__.py", line 8, in from .background_replacement import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement\background_replacement.py", line 11, in from .image_utils import ensure_resolution File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement\image_utils.py", line 4, in from .upscaler import upscale File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement\upscaler.py", line 4, in from realesrgan import RealESRGANer File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\realesrgan__init__.py", line 2, in from .archs import * File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\realesrgan\archs__init__.py", line 2, in from basicsr.utils import scandir File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr__init__.py", line 4, in from .data import * File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\data__init__.py", line 22, in dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames] File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\data__init_.py", line 22, in dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames] File "importlib__init_.py", line 126, in import_module File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\data\realesrgan_dataset.py", line 11, in from basicsr.data.degradations import circular_lowpass_kernel, random_mixed_kernels File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\data\degradations.py", line 8, in from torchvision.transforms.functional_tensor import rgb_to_grayscale ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'
Cannot import C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement module for custom nodes: No module named 'torchvision.transforms.functional_tensor'
(IMPORT FAILED): C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacement

After googling a bit, I found and took the advice from this link: AUTOMATIC1111/stable-diffusion-webui#13985 (comment)

After I did this, when ComfyUI was launched, several modules were downloaded and updated, and everything seemed to work. In fact, this is a rather complex and non-obvious solution to problems with installing only two nodes, so it would be great if the developer made corrections to his code.

that worked thanks

@lior007
Copy link

lior007 commented Nov 16, 2024

ME TO

TRY change:

from torchvision.transforms.functional_tensor import rgb_to_grayscale
to:
from torchvision.transforms.functional import rgb_to_grayscale

NOT HELP FOR ME

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