12
votes

I have scoured the web (including the 6 links that show similar problems with Heroku, Anaconda etc but common root cause - resource corpora/wordnet not found) and performed all that I could which includes but is not limited to -

  1. Changing the download directory (and subsequently setting nltk_data path by 3 methods as below) 3 times to /usr/lib/nltk_data, /home/ubuntu/nltk_data and /home/ubuntu/quepy/nltk_data.
  2. Changed the path by (i) changing the NLTK_DATA_PATH in settings.py in the required quepy app for all three paths (ii) using the nltk.data.path.append command for all three paths (iii) using the export NLTK_DATA command for all three paths
  3. I even went on to give permission 644 to the contents of nltk_data directory recursively
  4. Used the python -m nltk.downloader AND nltk.download command with the specific paths to install and configured the paths (they both do the same thing)

Even after 3 hours of trying I am nowhere. I would really appreciate if anyone could point me on how to successfully run the Quepy example (python main.py "Who is Tom Cruise?") at location: quepy/examples/dbpedia. It is not a problem with Quepy but why on Earth can it not find the resource.

Here is the exact error -

Resource u'corpora/wordnet' not found.  Please use the NLTK
Downloader to obtain the resource:  >>> nltk.download()

Searched in:

  - 'home/ubuntu/nltk_data'

NOTE -

  • I installed it successfully on another machine without a problem and it ran correctly but on the initial machine the problem is still unresolved, exact same steps, exact version of the app and its related tools/dependencies.

  • Even though not showing in the error log my class-paths start with a slash as observed by nltk.data.path

2
let nltk decide where to store the file and where to access them. see answer. - alvas
Its not the duplicate at all @alvas but thanks for the link, also I have tried to let nltk decide and gave the path where it downloaded to the quepy app without any success. - Shivansh Singh
Could you give the traceback? Possibly that'll help. - alvas
You should really (always) make an effort to narrow down your problem. Write a two-line script that loads one resource, e.g. from nltk.corpus import wordnet; x=wordnet.all_lemma_names(). Show the program and the full error trace here. Also state where your nltk_data directory actually is. - alexis

2 Answers

0
votes

Your paths seem incomplete. In Unix filesystems, a full path always begins with a slash: /path/to/file/is/well-formed/example.txt. While you are learning, it is always a good practice to check your full path in the shell (i.e. command line) using ls.

$ ls /path/to/example/file.txt
/path/to/example/file.txt
$ ls /this/one/is/not/there.txt
ls: /this/one/is/not/there.txt: No such file or directory

If you get No such file or directory, then your path is bad.

0
votes

If you are certain it is not an issue with Quepy, recursively change the permissions to 755 and see if any new error(s).