Skip to content

fix: Drop the Dead NLTK Download That Breaks Image Builds - #329

Merged
danny-avila merged 1 commit into
mainfrom
danny-avila/drop-nltk-step
Sep 23, 2026
Merged

danny-avila merged 1 commit into
mainfrom
danny-avila/drop-nltk-step

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

Summary

Every image build on main has failed since 52989197 bumped unstructured from 0.18.32 to 0.27.8. Both Dockerfiles run a step that downloads NLTK data, and it now dies with ModuleNotFoundError: No module named 'nltk' (failed job). Nothing is being published to librechat-rag-api-dev or -dev-lite until this lands.

unstructured 0.18.32 declared nltk as a dependency; 0.27.8 does not. That is not an oversight on their side: 0.27.8 no longer uses NLTK at all. It ships its own sent_tokenize, word_tokenize and pos_tag in unstructured/nlp/tokenize.py, and none of its 138 modules mention NLTK. This repository's own code never imported it either.

So the step is dead weight rather than a missing dependency. This removes it, along with the NLTK_DATA variable, from both Dockerfile and Dockerfile.lite, instead of reinstalling NLTK and downloading data nothing reads.

How it works

 RUN pip install --no-cache-dir -r requirements.lite.txt
-ENV NLTK_DATA=/app/nltk_data
-
-# Download standard NLTK data, to prevent unstructured from downloading packages at runtime
-RUN python -c "import nltk, sys; packages = ('punkt_tab', ...)"
-
 # Disable Unstructured analytics

Same change in both files. The images also get smaller, since they no longer carry the punkt and tagger data.

Testing

  • Checked PyPI metadata: unstructured 0.18.32 requires_dist includes nltk; 0.27.8 lists none.
  • Extracted the 0.27.8 wheel and searched every module: no import nltk, no reference to it at all.
  • Searched app/ here: no NLTK usage.
  • The image build is the real check. It runs on merge to main, not on pull requests, so the first build after merge is what confirms it.

@danny-avila
danny-avila merged commit 0029515 into main Sep 23, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

1 participant