Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

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

Open
timsoraro opened this issue Jul 11, 2020 · 9 comments
Open

Comments

@timsoraro
Copy link

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 timsoraro changed the title ModuleNotFoundError: No module named 'worlds running server.py ModuleNotFoundError: No module named 'worlds' while running server.py Jul 11, 2020
@stephenroller
Copy link
Contributor

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
Copy link
Contributor

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

cc @JackUrb for the wider issue.

@timsoraro
Copy link
Author

timsoraro commented Jul 12, 2020

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.

@stephenroller
Copy link
Contributor

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

@timsoraro
Copy link
Author

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.

@stephenroller
Copy link
Contributor

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

@timsoraro
Copy link
Author

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.

@stephenroller
Copy link
Contributor

Thanks!

@github-actions
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants