Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Cannot execute craigslistbargain/web/chat_app.py #50

Closed
Mocchaso opened this issue Nov 30, 2018 · 8 comments
Closed

Question: Cannot execute craigslistbargain/web/chat_app.py #50

Mocchaso opened this issue Nov 30, 2018 · 8 comments

Comments

@Mocchaso
Copy link

Mocchaso commented Nov 30, 2018

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
@hhexiy
Copy link
Collaborator

hhexiy commented Nov 30, 2018

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.

@Mocchaso
Copy link
Author

Mocchaso commented Dec 1, 2018

@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

@hhexiy
Copy link
Collaborator

hhexiy commented Dec 1, 2018

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>

@Mocchaso
Copy link
Author

Mocchaso commented Dec 1, 2018

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

@hhexiy
Copy link
Collaborator

hhexiy commented Dec 1, 2018

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

@Mocchaso
Copy link
Author

Mocchaso commented Dec 2, 2018

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?

@hhexiy
Copy link
Collaborator

hhexiy commented Dec 2, 2018

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

@Mocchaso
Copy link
Author

Mocchaso commented Dec 2, 2018

OK, thank you very much for many replying!

@Mocchaso Mocchaso closed this as completed Dec 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants