ParlAI
ParlAI copied to clipboard
ModuleNotFoundError: No module named 'worlds' while running server.py
Bug description Running the server.py script result in module no found error.
Reproduction steps
- Clone current repo.
- Run
python setup.py development
- 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
Looks like the PersonaChat task needs some upgrades.
My guess is that the import should be upgraded to from .worlds import PersonaChatWorld, PersonaProfileWorld, PersonaGenerator
Small nit: Idk if python setup.py development
also works or if only python setup.py develop
does.
cc @JackUrb for the wider issue.
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.
Would you mind submitting a patch? Would be great to have this fixed for everyone.
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.
can you run git diff -- parlai/mturk/tasks
and paste the result here?
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.
Thanks!
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.