pltrdy / files2rouge

Calculating ROUGE score between two files (line-by-line)
MIT License
191 stars 53 forks source link

Check that the file exists or initialize it with 'setup_rouge.py' #11

Closed wasiahmad closed 6 years ago

wasiahmad commented 6 years ago

Getting the following error when trying to use files2rouge.

Can't load ROUGE settings in '/home/wasiahmad/software/anaconda3/lib/python3.6/site-packages/files2rouge/settings.json'. Check that the file exists or initialize it with 'setup_rouge.py'

How to solve the error?

pltrdy commented 6 years ago

It seems like you installed the module before running setup_rouge.py.

Check installation guide https://github.com/pltrdy/files2rouge#getting-started

wasiahmad commented 6 years ago

I exactly followed the guide. First, install pyrouge using the command provided and then the repo is cloned and the required commands are executed. But still the error persists and it appears when I try to execute files2rouge with the reference and summary files.

pltrdy commented 6 years ago
  1. cd in your files2rouge root folder
  2. Check if you have a setting file: ls files2rouge | grep "settings.json" i. there is nothing: set ROUGE settings with ./setup_rouge.py and set an empty path (you will get an error if the path exists) ii. their is a settings.json file: reinstall the module: pip install -U . (note the . is part of the command).
  3. check the installation: python -c "import files2rouge; f = files2rouge.Settings(); f._load(); print(f.data)"

It must not raise error and return some paths.

wasiahmad commented 6 years ago

I followed your instruction and I get the following when I check the installation.

{'ROUGE_path': '/home/wasiahmad/.files2rouge/ROUGE-1.5.5.pl', 'ROUGE_data': '/home/wasiahmad/.files2rouge/data'}

But when I run the files2rouge command as follows with the summary and reference files, it is still giving the same error.

files2rouge data/model_summaries/predicted_summary.txt data/system_summaries/test.txt.tgt.tagged

pltrdy commented 6 years ago
  1. Print python version: which python
  2. Print files2rouge module path: python -c "import files2rouge; print(files2rouge)"
  3. Print files2rouge command path: which files2rouge
  4. Print files2rouge command code: cat $(which files2rouge)
wasiahmad commented 6 years ago
  1. ~/software/anaconda3/bin/python

  2. <module 'files2rouge' from '/home/wasiahmad/software/anaconda3/lib/python3.6/site-packages/files2rouge-2.0.0-py3.6.egg/files2rouge/init.py'>

  3. ~/software/anaconda3/bin/files2rouge

#!/home/wasiahmad/software/anaconda3/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'files2rouge==2.0.0','console_scripts','files2rouge'
__requires__ = 'files2rouge==2.0.0'
import re
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(
        load_entry_point('files2rouge==2.0.0', 'console_scripts', 'files2rouge')()
    )
pltrdy commented 6 years ago

It's really strange. It does not make sense that: python -c "import files2rouge; f = files2rouge.Settings(); f._load(); print(f.data)" works but the files2rouge command does not, since we precisely test the step that may cause troubles.

I'm running out of idea to be honnest, maybe could you check permissions: ls -l /home/wasiahmad/software/anaconda3/lib/python3.6/site-packages/files2rouge/

sshleifer commented 4 years ago

Same bug if anyone has ideas. Maybe has to do with $PATH/anaconda?

pltrdy commented 4 years ago

@sshleifer try to install in the folder using:

cd files2rouge
pip install -U -e .
sshleifer commented 4 years ago

That fails with some other error

FileNotFoundError: [Errno 2] No such file or directory: '/Users/shleifer/miniconda3/envs/nb/lib/python3.7/site-packages/files2rouge-2.1.0-py3.7.egg'

But all is well, I got it working in python. Thanks for the help!