scenic icon indicating copy to clipboard operation
scenic copied to clipboard

ModuleNotFoundError: No module named 'scenic.projects.token_learner'

Open F-Yuan303 opened this issue 3 years ago • 5 comments

Hi, why this error occurs when trying to run the code with the command blow " python scenic/projects/token_learner/main.py --
--config=scenic/projects/token_learner/configs/im1k_token_learner_config.py
--workdir=token_learner/ "

F-Yuan303 avatar Dec 09 '21 13:12 F-Yuan303

@F-Yuan303 I think that this is due to relative imports.

Anirudh257 avatar Jan 27 '22 11:01 Anirudh257

I think a __init__.py is missing and I look at it later, but feel free to send a PR if you have a fix.

MostafaDehghani avatar Jan 27 '22 12:01 MostafaDehghani

I think a __init__.py is missing and I look at it later, but feel free to send a PR if you have a fix.

Both vivit and token_learner can't be found when imort them. I added blank __init__.py files under token_lerarner and vivit with reference to other folders, but still reported an error.

leijue222 avatar Apr 21 '22 07:04 leijue222

Hello everyone, I was getting a similar issue when I tried to run the example included in the README file:

$ python scenic/main.py -- \
  --config=scenic/projects/baselines/configs/imagenet/imagenet_vit_config.py \
  --workdir=./
Traceback (most recent call last):
  File "/zfs1/home/userenv/Scenic/scenic-main/scenic/main.py", line 27, in <module>
    from scenic.train_lib import trainers
  File "/home/userenv/.conda/envs/scenic/lib/python3.9/site-packages/scenic/train_lib/trainers.py", line 18, in <module>
    from scenic.train_lib.transfer import transfer_trainer
ModuleNotFoundError: No module named 'scenic.train_lib.transfer'

It seems that I fixed it just by adding a blank __init__.py to both scenic\train_lib\transfer and scenic\train_lib\transfer\tests folders, and redoing the installation with pip install .

JTorres258 avatar Aug 25 '22 13:08 JTorres258

I had the same problem,you can try insert: " import os, sys sys.path.append(os.getcwd())" before "from scenic import XXX" in "main.py".

likeyouli avatar Aug 30 '22 14:08 likeyouli