TorchSeg icon indicating copy to clipboard operation
TorchSeg copied to clipboard

ModuleNotFoundError: No module named 'utils.pyt_utils'

Open artzimy opened this issue 4 years ago • 3 comments

Trying to run bash script.sh I got the following error

Traceback (most recent call last): File "train.py", line 17, in from dataloader import get_train_loader File "/media/D/users/Idan/Suha_Maryam/TorchSemiSeg-main/exp.voc/voc8.res50v3+.CPS/dataloader.py", line 8, in from utils.img_utils import generate_random_crop_pos, random_crop_pad_to_shape ModuleNotFoundError: No module named 'utils.img_utils' Traceback (most recent call last): File "eval.py", line 13, in from utils.pyt_utils import ensure_dir, link_file, load_model, parse_devices ModuleNotFoundError: No module named 'utils.pyt_utils'

Adding [to script.sh before import utils] PYTHONPATH="<MyPath>/TorchSemiSeg-main/furnace/"
Did not solve the problem

What could be the problem? Thanks Moran

artzimy avatar Oct 29 '21 07:10 artzimy

You could try this: import sys sys.path.append('absolute path of you file: img_utils')

Lingxuewang avatar Mar 23 '23 13:03 Lingxuewang

I also encountered this problem when running the program. I tried your method and it didn't solve it. What is the specific reason? Is there a way to solve it?

ChenShupan avatar Apr 08 '23 14:04 ChenShupan

你可以试试这个:导入sys sys.path.append('你的文件的绝对路径:img_utils')

I also encountered this problem when running the program. I tried your method and it didn't solve it. What is the specific reason? Is there a way to solve it?

ChenShupan avatar Apr 08 '23 14:04 ChenShupan