WordNet corpus is reported as downloaded but cannot be found by WordNetLemmatizer
Author: knkn464Created Sep 29, 2026Updated Sep 29, 2026
Environment
- OS: Linux container
- Python: 3.11.x
- NLTK: 3.10.3
- Installation method: pip
- Runtime: Nuclio/Kubernetes
- Corpus download directory:
/usr/local/lib/nltk_data
Problem
wordnet is downloaded during the Docker image build, but the serving container fails at runtime with:
LookupError: Resource wordnet not found.
Please use the NLTK Downloader to obtain the resource:
>>> nltk.download('wordnet')
**Expected behavior**
After downloading wordnet, this should succeed:
WordNetLemmatizer().lemmatize("bearings")
**Expected output:**
bearing
**Actual behavior**
The container fails during application initialization
LookupError: Resource 'wordnet' not found
File ".../nltk/corpus/util.py", line ...
raise ebelow are the build logs:
#11 [6/9] RUN python -m nltk.downloader -d /usr/local/lib/nltk_data stopwords
#11 1.335 <frozen runpy>:128: RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour
#11 1.386 [nltk_data] Downloading package stopwords to
#11 1.386 [nltk_data] /usr/local/lib/nltk_data...
#11 1.421 [nltk_data] Unzipping corpora/stopwords.zip.
#11 DONE 1.6s
#12 [7/9] RUN python -m nltk.downloader -d /usr/local/lib/nltk_data wordnet
#12 1.020 <frozen runpy>:128: RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour
#12 1.064 [nltk_data] Downloading package wordnet to /usr/local/lib/nltk_data...
#12 DONE 1.3s
#13 [8/9] RUN python -m nltk.downloader -d /usr/local/lib/nltk_data omw-1.4
#13 1.075 <frozen runpy>:128: RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour
#13 1.117 [nltk_data] Downloading package omw-1.4 to /usr/local/lib/nltk_data...
#13 DONE 1.4sBelow is the error log:
Source: nltk/nltk