facebookresearch / ParlAI

A framework for training and evaluating AI models on a variety of openly available dialogue datasets.
https://parl.ai
MIT License
10.49k stars 2.1k forks source link

No module named 'torch' #181

Closed JackZhang1988 closed 7 years ago

JackZhang1988 commented 7 years ago

i try to run ParlAi example python examples/display_data.py -t babi:task1k:1 but i got belwo error:

[task:babi:task1k:1]
[download_path:/Applications/My-Project/ParlAI/downloads]
[datatype:train]
[image_mode:raw]
[numthreads:1]
[batchsize:1]
[datapath:/Applications/My-Project/ParlAI/data]
[num_examples:10]
[parlai_home:/Applications/My-Project/ParlAI]
[creating task(s): babi:task1k:1]
Traceback (most recent call last):
  File "examples/display_data.py", line 42, in <module>
    main()
  File "examples/display_data.py", line 30, in main
    world = create_task(opt, agent)
  File "/Applications/My-Project/ParlAI/parlai/core/worlds.py", line 806, in create_task
    world = create_task_world(opt, user_agents)
  File "/Applications/My-Project/ParlAI/parlai/core/worlds.py", line 778, in create_task_world
    world_class, task_agents = _get_task_world(opt)
  File "/Applications/My-Project/ParlAI/parlai/core/worlds.py", line 773, in _get_task_world
    task_agents = _create_task_agents(opt)
  File "/Applications/My-Project/ParlAI/parlai/core/agents.py", line 371, in _create_task_agents
    my_module = importlib.import_module(module_name)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Applications/My-Project/ParlAI/parlai/tasks/babi/agents.py", line 7, in <module>
    from parlai.core.fbdialog_teacher import FbDialogTeacher
  File "/Applications/My-Project/ParlAI/parlai/core/fbdialog_teacher.py", line 42, in <module>
    from .dialog_teacher import DialogTeacher
  File "/Applications/My-Project/ParlAI/parlai/core/dialog_teacher.py", line 9, in <module>
    from .image_featurizers import ImageLoader
  File "/Applications/My-Project/ParlAI/parlai/core/image_featurizers.py", line 8, in <module>
    import torch
ModuleNotFoundError: No module named 'torch'

My system is MacOs, and the python version is 3.6.1, i have install the dependent package by python setup.py develop, but still got this error,

what's the problem?

alexholdenmiller commented 7 years ago

Thanks for flagging! Updating to help with this in #182

alexholdenmiller commented 7 years ago

Should only import torch if it's using it now, and give a better error message

ioana-blue commented 7 years ago

@alexholdenmiller import torch made it back in this commit: https://github.com/facebookresearch/ParlAI/commit/9484876234728b53c976c730bc2102e1c917ee78

alexholdenmiller commented 7 years ago

@ioana-blue thanks for flagging!