meap158 / ComfyUI-Background-Replacement

Instantly replace your image's background
MIT License
47 stars 8 forks source link

Import Failed #5

Open tiago-falves opened 5 months ago

tiago-falves commented 5 months ago

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 commented 5 months ago

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

ModzhaHead commented 4 months ago

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 commented 4 months ago

File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacementinit.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\realesrganinit.py", line 2, in from .archs import File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\realesrgan\archsinit.py", line 2, in from basicsr.utils import scandir File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsrinit.py", line 4, in from .data import File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\datainit.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\datainit.py", line 22, in _dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames] File "importlibinit.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: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/13985#issuecomment-1813885266

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 commented 3 weeks ago

File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Background-Replacementinit.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\realesrganinit.py", line 2, in from .archs import File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\realesrgan\archsinit.py", line 2, in from basicsr.utils import scandir File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsrinit.py", line 4, in from .data import File "C:\ComfyUI_windows_portable\python_embeded\lib\site-packages\basicsr\datainit.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\datainit.py", line 22, in _dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames] File "importlibinit.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