0

I'm on an OS Catalina and I'm trying to install and run Mephisto (see https://github.com/facebookresearch/mephisto/blob/master/docs/quickstart.md). I created a python3 virtual environment and then went to the directory and ran

sudo pip3 install -e .

This seems to have run fine as I can now run mephisto and see the list of commands and options. However when I run mephisto register mturk it throws No module named 'mephisto.core.argparse_parser' because of an import statement in the python file. This seems like a general issue of a module installing but not importing the module properly, but would appreciate help in how to fix it. Is it because my $PYTHONPATH is currently empty?

jyu429
  • 303
  • 2
  • 9

3 Answers3

1

Mephisto Lead here! This seems to have been a case of unfortunate timing, as we were in the midst of a refactor there and some code got pushed to master that should've received more scrutiny. We'll be moving to stable releases via PyPI in the near future to prevent things like this!

0

I created a python3 virtual environment and then went to the directory and ran

sudo pip3 install -e .

You should not have used sudo to install this library, if you meant to install it in a virtual environment. By using sudo the library probably got installed in the global environment (not in the virtual environment).

Typically:

  • create a virtual environment:
    • python3 -m venv path/to/venv
  • install tools and libraries in this environment with:
    • path/to/venv/bin/python -m pip install Mephisto
  • use python in the virtual environment:
    • path/to/venv/bin/python -c 'import mephisto'
  • use a tool in the virtual environment:
    • path/to/venv/bin/mephisto

Is it because my $PYTHONPATH is currently empty?

Forget PYTHONPATH. Basically one should never have to modify this environment variable (this is almost always ill-informed advice to get PYTHONPATH involved).

sinoroc
  • 18,409
  • 2
  • 39
  • 70
  • Thanks! However, it still seems like its not importing? Command: ```path/to/venv/bin/mephisto register mturk``` Output: ```ModuleNotFoundError: No module named 'mephisto.core.argparse_parser'``` – jyu429 Nov 30 '20 at 19:14
  • "_(Note: if you haven't set up mephisto with poetry, you should replace the mephisto command with python mephisto/client/cli.py instead)_" -- https://github.com/facebookresearch/mephisto/blob/master/docs/quickstart.md#step-2-run-the-same-task-again-but-now-on-mturk – sinoroc Nov 30 '20 at 20:12
  • Yes, I tried that too and it gives the same issue. – jyu429 Nov 30 '20 at 20:42
  • What is the output of `path/to/venv/bin/python -m pip show -v --files mephisto`? – sinoroc Nov 30 '20 at 22:47
0

Check the __init__.py file is in the module's file directory. If not try creating an empty one.

esantix
  • 323
  • 5
  • 26
  • https://stackoverflow.com/questions/56861605/pip-list-shows-installed-module-but-still-getting-import-error/59633953#59633953 – esantix Jan 22 '21 at 20:41