Unable to use nltk

This topic came up before but was left unanswered.

File “/opt/render/project/src/.venv/lib/python3.9/site-packages/nltk/data.py”, line 583, in find

raise LookupError(resource_not_found)

LookupError:


Resource punkt not found.

Please use the NLTK Downloader to obtain the resource:

import nltk

nltk.download(‘punkt’)

For more information see: NLTK :: Installing NLTK Data

Attempted to load tokenizers/punkt/PY3/english.pickle

Searched in:

  • ‘/opt/render/nltk_data’

  • ‘/opt/render/nltk_data’

  • ‘/opt/render/project/src/.venv/nltk_data’

  • ‘/opt/render/project/src/.venv/share/nltk_data’

  • ‘/opt/render/project/src/.venv/lib/nltk_data’

  • ‘/usr/share/nltk_data’

  • ‘/usr/local/share/nltk_data’

  • ‘/usr/lib/nltk_data’

  • ‘/usr/local/lib/nltk_data’

  • ‘’

I have a start.sh file that runs on build

pip install --upgrade pip
pip install -r requirements.txt
pip list
python -m nltk.downloader punkt

Hi there,

I think the issue here is that none of those directories listed are retained between build time and runtime. So when you downloaded the data set during your build, it would not exist at runtime. Try having the NLTK_DATA environment variable set to something like /opt/render/project/src/nltk_data. If the download process doesn’t create this directory if it doesn’t exist, you might need to add mkdir nltk_data as part of your build script (you will already be in /opt/render/project/src).

Regards,

Keith
Render Support, UTC+10 :australia:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.