stanfordnlp/cocoa

Question: Cannot execute craigslistbargain/web/chat_app.py

Closed this issue · 8 comments

Hello.

In order to try to use cocoa system, I added to write paths below to /home/(user_name)/.pyenv/versions/anaconda3-5.3.0/envs/py27/lib/python2.7/site-packages/easy-install.pth.

  • (auto-written by setup.py) /mnt/c/users/(admin_name)/cocoa-master
  • /mnt/c/users/(user_name)/cocoa-master/cocoa
  • /mnt/c/users/(user_name)/cocoa-master/onmt
  • /mnt/c/users/(user_name)/cocoa-master/craigslistbargain
  • /mnt/c/users/(user_name)/cocoa-master/craigslistbargain/web
  • /mnt/c/users/(user_name)/cocoa-master/craigslistbargain/core

After that, I ran craigslistbargain/web/chat_app.py on Python 2.7.15.
However, this execution failed. The error is as follows:

Traceback (most recent call last):
  File "chat_app.py", line 19, in <module>
    from core.scenario import Scenario
ImportError: No module named scenario

What should I do?
I would appreciate if you could teach the solution.

Environment

  • Ubuntu 18.04 (Linux Subsystem of Windows 10 Education)
  • Python 2.7.15 on Anaconda virtual environment
    • Pytorch 0.4.1.post2

You don't need to add all the paths. Have you run python setup.py develop? Please follow installation instruction here: https://github.com/stanfordnlp/cocoa#installation

Then just run the commands in the craigslist directory.

@hhexiy
Thank you very much for replying.

Yes, I ran pip install -r requirements.txt and python setup.py develop, with reading Section: installation.
However, I failed to run all in patterns below.
What should I do to run chat_app.py...?

  • python craigslistbargain/web/chat_app.py at /mnt/c/users/(user_name)/cocoa-master
  • python web/chat_app.py at /mnt/c/users/(user_name)/cocoa-master/craigslistbargain
  • python chat_app.py at /mnt/c/users/(user_name)/cocoa-master/craigslistbargain/web

See https://github.com/stanfordnlp/cocoa#web.

cd craigslistbargain;
PYTHONPATH=. python web/chat_app.py --port 5000 --config web/app_params.json --schema-path <path-to-schema> --scenarios-path <path-to-scenarios> --output <output-dir>

I'm trying a Section: Building the bot, Use the modular approach, 2. Parse the training dialogues.

When I executed first command in this section, an error occurred.
How can I resolve this error?

Error

Traceback (most recent call last):
  File "parse_dialogue.py", line 95, in <module>
    print generator.retrieve('<start>', context_tag='<start>', tag=action, category='car', role='seller').template
  File "/mnt/c/users/administrator/my_sotuken_src/cocoa-master/cocoa/model/generator.py", line 55, in retrieve
    candidates = candidates.iloc[ids]
  File "/home/mocchaso/.pyenv/versions/anaconda3-5.3.0/envs/py27/lib/python2.7/site-packages/pandas/core/indexing.py", line 1478, in __getitem__
    return self._getitem_axis(maybe_callable, axis=axis)
  File "/home/mocchaso/.pyenv/versions/anaconda3-5.3.0/envs/py27/lib/python2.7/site-packages/pandas/core/indexing.py", line 2091, in _getitem_axis
    return self._get_list_axis(key, axis=axis)
  File "/home/mocchaso/.pyenv/versions/anaconda3-5.3.0/envs/py27/lib/python2.7/site-packages/pandas/core/indexing.py", line 2073, in _get_list_axis
    raise IndexError("positional indexers are out-of-bounds")
IndexError: positional indexers are out-of-bounds

hmm. I cannot reproduce the error. Can you check if you pandas version is pandas=0.20.3=py27_0? I also added environment.yml here: https://github.com/stanfordnlp/cocoa/blob/master/environment.yml

Thank you for adding environment.yml.
When I downgraded pandas from 0.23.4 to 0.20.3, I could finished executing Section: Parse the training dialogues.

However, I couldn't copy an environment from environment.yml.
The following error occurred.

$ conda env create --file environment.yml
(Other logs were outputted)
Could not find a version that satisfies the requirement cocoa==0.1

After comment out cocoa==0.1, the following error occurred.

$ conda env create --file environment.yml
(Other logs were outputted)
Could not find a version that satisfies the requirement en-core-web-sm==1.2.0

After comment out en-core-web-sm==1.2.0, command conda env create --file environment.yml succeeded.

If I execute python setup.py develop necessarily, is it ok to delete cocoa==0.1 and en-core-web-sm==1.2.0 in environment.yml?

That should be fine. en-core-web-sm is the Spacy model that you can download later if needed.

OK, thank you very much for many replying!