Open xvel opened 3 years ago
This seems unrelated to MiDaS. I believe you might have naming conflict with some file shadowing the MiDaS namespace. See here: https://stackoverflow.com/questions/59502364/modulenotfounderror-no-module-named-xxx-xxx-is-not-a-package
u can change this import code ,like this
# from midas.dpt_depth import DPTDepthModel
from MiDaS.midas.dpt_depth import DPTDepthModel
# from midas.midas_net import MidasNet
from MiDaS.midas.midas_net import MidasNet
# from midas.midas_net_custom import MidasNet_small
from MiDaS.midas.midas_net_custom import MidasNet_small
# from midas.transforms import Resize, NormalizeImage, PrepareForNet
from MiDaS.midas.transforms import Resize, NormalizeImage, PrepareForNet
this use path to find class name and import it
This seems unrelated to MiDaS. I believe you might have naming conflict with some file shadowing the MiDaS namespace. See here: https://stackoverflow.com/questions/59502364/modulenotfounderror-no-module-named-xxx-xxx-is-not-a-package
Right, this is unrelated with MiDaS. Was parent folder was named midas and my file midas.py, I renamed both and now it works (maybe only one has to be renamed)
I have fixed this error with pip install timm
ModuleNotFoundError: No module named 'midas.dpt_depth'; 'midas' is not a package
This error pops up again, I have timm, and the midas model is in a ComfyUI directory, unsure what installed it. I've searched for potentially shadowing variables, but none of the midas
variables seemed to be the culprit. What helps for me is placing an (empty) __init__.py
in the ComfyUI/models/midas/intel-isl_MiDaS_master/midas
directory.
if you tried "pip install midas" before thinking it was correct thats whats causing the issue. #2023
pip uninstall midas, pip install timm
and that should fix it all.
I get the same error. This is my usage of the node:
I tried "pip uninstall midas" and "pip install timm". After restarting I still get this error.
Stacktrace:
WAS Node Suite: Downloading and loading MiDaS Model... Using cache found in E:\Software\ComfyUI_windows_portable\ComfyUI\models\midas\intel-isl_MiDaS_master !!! Exception during processing !!! No module named 'midas.dpt_depth' Traceback (most recent call last): File "E:\Software\ComfyUI_windows_portable\ComfyUI\execution.py", line 323, in execute output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Software\ComfyUI_windows_portable\ComfyUI\execution.py", line 198, in get_output_data return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Software\ComfyUI_windows_portable\ComfyUI\execution.py", line 169, in _map_node_over_list process_inputs(input_dict, i) File "E:\Software\ComfyUI_windows_portable\ComfyUI\execution.py", line 158, in process_inputs results.append(getattr(obj, func)(*inputs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Software\ComfyUI_windows_portable\ComfyUI\custom_nodes\was-node-suite-comfyui\WAS_Node_Suite.py", line 8949, in midas_remove midas = torch.hub.load("intel-isl/MiDaS", midas_model, trust_repo=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Software\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\hub.py", line 568, in load model = _load_local(repo_or_dir, model, args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Software\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\hub.py", line 594, in _load_local hub_module = _import_module(MODULE_HUBCONF, hubconf_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Software\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\hub.py", line 106, in _import_module spec.loader.exec_module(module) File "
", line 940, in exec_module File " ", line 241, in _call_with_frames_removed File "E:\Software\ComfyUI_windows_portable\ComfyUI\models\midas\intel-isl_MiDaS_master\hubconf.py", line 5, in from midas.dpt_depth import DPTDepthModel ModuleNotFoundError: No module named 'midas.dpt_depth'
I read something about renaming folders. Could somebody provide details? I am not sure what to rename and where. At least it seems I have the "midas" folder:
I just wanted to try the depth map.
Can't download model
model = torch.hub.load("intel-isl/MiDaS", "DPT_Large")
gives this on Windows 10, Anaconda env, Pytorch 1.9, Pycharm IDE