ParlAI icon indicating copy to clipboard operation
ParlAI copied to clipboard

ModuleNotFoundError: No module named 'worlds' while running server.py

Open timsoraro opened this issue 4 years ago • 9 comments

Bug description Running the server.py script result in module no found error.

Reproduction steps

  1. Clone current repo.
  2. Run python setup.py development
  3. Run inside webapp: python server.py --sandbox

Expected behavior The server is showing in http://localhost:8095 but when trying to click on a task I'm running into the error below in the screenshot.

Screenshots Screen Shot 2020-07-11 at 4 13 37 PM

timsoraro avatar Jul 11 '20 13:07 timsoraro

Looks like the PersonaChat task needs some upgrades.

My guess is that the import should be upgraded to from .worlds import PersonaChatWorld, PersonaProfileWorld, PersonaGenerator

stephenroller avatar Jul 12 '20 03:07 stephenroller

Small nit: Idk if python setup.py development also works or if only python setup.py develop does.

cc @JackUrb for the wider issue.

stephenroller avatar Jul 12 '20 03:07 stephenroller

My guess is that the import should be upgraded to from .worlds import PersonaChatWorld, PersonaProfileWorld, PersonaGenerator

That worked! Thanks!

Feel free to close this issue or keep it open.

timsoraro avatar Jul 12 '20 06:07 timsoraro

Would you mind submitting a patch? Would be great to have this fixed for everyone.

stephenroller avatar Jul 12 '20 14:07 stephenroller

I'm sorry, I'm not proficient enough with git to have the know-how to do so. But as you said that will require a (simple) change in all the "tasks" folder, I guess.

timsoraro avatar Jul 12 '20 17:07 timsoraro

can you run git diff -- parlai/mturk/tasks and paste the result here?

stephenroller avatar Jul 13 '20 01:07 stephenroller

I hope it doesn't catch some unnecessary changes I did:

diff --git a/parlai/mturk/tasks/personachat/personachat_chat/run.py b/parlai/mturk/tasks/personachat/personachat_chat/run.py
index e5553c8b..3a474dbc 100644
--- a/parlai/mturk/tasks/personachat/personachat_chat/run.py
+++ b/parlai/mturk/tasks/personachat/personachat_chat/run.py
@@ -5,8 +5,8 @@
 # LICENSE file in the root directory of this source tree.
 from parlai.core.params import ParlaiParser
 from parlai.mturk.core.mturk_manager import MTurkManager
-from worlds import PersonaChatWorld, PersonaProfileWorld, PersonasGenerator
-from task_config import task_config
+from .worlds import PersonaChatWorld, PersonaProfileWorld, PersonasGenerator
+from .task_config import task_config
 
 import os
 
diff --git a/parlai/mturk/tasks/personachat/personachat_chat/worlds.py b/parlai/mturk/tasks/personachat/personachat_chat/worlds.py
index 7a45a7a0..5f8dd2b7 100644
--- a/parlai/mturk/tasks/personachat/personachat_chat/worlds.py
+++ b/parlai/mturk/tasks/personachat/personachat_chat/worlds.py
@@ -7,7 +7,7 @@ from parlai.mturk.core.worlds import MTurkOnboardWorld
 from parlai.mturk.core.agents import TIMEOUT_MESSAGE
 from parlai.core.worlds import validate, MultiAgentDialogWorld
 from joblib import Parallel, delayed
-from extract_and_save_personas import main as main_extract
+from .extract_and_save_personas import main as main_extract
 import numpy as np
 import time
 import os

The only change relevant to this issue is adding the a dot before the files.

timsoraro avatar Jul 14 '20 08:07 timsoraro

Thanks!

stephenroller avatar Jul 14 '20 12:07 stephenroller

This issue has not had activity in 30 days. Please feel free to reopen if you have more issues. You may apply the "never-stale" tag to prevent this from happening.

github-actions[bot] avatar Aug 14 '20 00:08 github-actions[bot]