Nltk resource not found

I am trying to run docker-compose.yml file which went on fine. Suddenly I started getting NLTK downloader issue. Anyone faced such issue while building the docker containers? NLTK is installed successfully in rasa-worker and rasa-production whereas its giving resource not found issue in action server docker build.

Any help would be very helpful. Thanks in advance.

please mention nltk in the requirements.txt file for the action server

This is my docker file for action server:

FROM rasa/rasa-sdk:2.8.2

Change back to root user to install dependencies

USER root

RUN apt-get update -qq &&
apt-get install -y libssl-dev &&
# apt-get install -y python3.7-dev &&
apt-get install -y default-libmysqlclient-dev &&
apt-get install -y build-essential &&
apt-get clean &&
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

WORKDIR /app

To install packages from PyPI

COPY ./requirements-actions.txt . RUN pip install --upgrade pip RUN pip install --no-cache-dir -r requirements-actions.txt

RUN pip install nltk &&
python -m nltk.downloader -d ‘/usr/share/nltk_data’ wordnet

And requirements.txt:

recognizers-text-suite==1.0.2a2 pytest==5.3.5 PyYAML==5.4.1 Pattern==3.6 typing-extensions==3.7.4.3 dateparser==1.0.0

Everything was running fine and was able to create docker containers without any issue. Yesterday I made a small code changes to actions.py file and pushed the code changes and then build the docker compose from when I started facing this NLTK issue. Not sure what went wrong as the code change also very simple variable name change only. Nothing to do with nltk.

I also tried adding " nltk" in the requirements.txt for the action server and removed from docker file but the same result.

@pnandhini can you please format the share code, it’s really hard to understand

OR

Note: [ This post is related to rasa open source installation using docker]

If you like you can see this thread and try to update your docker and docker-compose files: Dockerizing my rasa chatbot application that has botfront - #11 by nik202

Note: Please update the rasa image as per your requirement

Mention me with @ nik202 for a fast response.

@ nik202 Sure I will do in sometime. The issue is not with installing the packages. Its going fine with installation. When it tried to up the action server, resource not found issue is raised. I tried to run this docker compose in my local and got the same error now.

Installation step:

Server is starting:

@nik202 Thanks for your responses.

@pnandhini confirm with me are you trying to install rasa x? yes or no?

@nik202 yes

@pnandhini may be package installation is not done in action server image, please inspect the container or run the command docker-compose up

@pnandhini really :exploding_head::exploding_head:, please change the topic category to rasa X please and also mentioned the installation version and method for me.

@nik202 changed the topic category to rasa x.

@pnandhini please can you also tell me the installation method you are following?

@nik202 issue is action server docker keeps on restarting because of this error. Let me share the docker file again.

@pnandhini wait on your server please run these commands:

  1. docker ps and share the screenshot
  2. docker-compose down && docker-compose up and then see the app_1 and share me the screenshot it can be the issue or exit 0 or 1

Do it now.

@nik202 I am trying to install using docker-compose to install rasa x. Is this what you mean by installation method? Sorry I am new to rasa x docker installation. so far done only in local installation.

Docker compose ps and docker compose down

@pnandhini No worries, the method you are trying to install is already depreciated by Rasa, but previous versions such as 0.42.4 and 0.42.5 are giving results. So, we will solve it together.

@nik202 it was working fine until yesterday evening IST. I was able to down and up all the docker containers without any issue.

@pnandhini how you mentioned the nltk in requirment share that and also share me the docker-compoose-override.yml file screenshot please.

Actions Dockerfile

FROM rasa/rasa-sdk:2.8.2

# Change back to root user to install dependencies
USER root

RUN apt-get update -qq && \
    apt-get install -y libssl-dev && \
    # apt-get install -y python3.7-dev && \
    apt-get install -y default-libmysqlclient-dev && \
    apt-get install -y build-essential && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

WORKDIR /app

# To install packages from PyPI
COPY ./requirements-actions.txt .
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements-actions.txt

RUN pip install nltk && \
    python -m nltk.downloader -d '/usr/share/nltk_data' wordnet

Actions requirements-actions.txt:

recognizers-text-suite==1.0.2a2
pytest==5.3.5
PyYAML==5.4.1
Pattern==3.6
typing-extensions==3.7.4.3
dateparser==1.0.0

Docker-compose override:

version: '3.4'

x-database-credentials: &database-credentials
  DB_HOST: "db"
  DB_PORT: "5432"
  DB_USER: "${DB_USER:-admin}"
  DB_PASSWORD: "${DB_PASSWORD}"
  DB_LOGIN_DB: "${DB_LOGIN_DB:-rasa}"

x-rabbitmq-credentials: &rabbitmq-credentials
  RABBITMQ_HOST: "rabbit"
  RABBITMQ_USERNAME: "user"
  RABBITMQ_PASSWORD: ${RABBITMQ_PASSWORD}

x-redis-credentials: &redis-credentials
  REDIS_HOST: "redis"
  REDIS_PORT: "6379"
  REDIS_PASSWORD: ${REDIS_PASSWORD}
  REDIS_DB: "1"
  REDIS_CACHE_DB: "2"
  ACCEPTABLE_QUERY_COUNT_NUMBER: "50000"
  
x-duckling-credentials: &duckling-credentials
  RASA_DUCKLING_HTTP_URL: "http://duckling:8000"

x-rasax-credentials: &rasax-credentials
  RASA_X_HOST: "http://rasa-x:5002"
  RASA_X_USERNAME: ${RASA_X_USERNAME:-admin}
  RASA_X_PASSWORD: ${RASA_X_PASSWORD:-}
  RASA_X_TOKEN: ${RASA_X_TOKEN}
  JWT_SECRET: ${JWT_SECRET}
  RASA_USER_APP: "http://app:5055"
  RASA_PRODUCTION_HOST: "http://rasa-production:5005"
  RASA_WORKER_HOST: "http://rasa-worker:5005"
  RASA_TOKEN: ${RASA_TOKEN}

x-rasa-credentials: &rasa-credentials
  <<: *rabbitmq-credentials
  <<: *rasax-credentials
  <<: *database-credentials
  <<: *redis-credentials
  <<: *duckling-credentials
  RASA_TOKEN: ${RASA_TOKEN}
  RASA_MODEL_PULL_INTERVAL: 10
  RABBITMQ_QUEUE: "rasa_production_events"
  RASA_TELEMETRY_ENABLED: ${RASA_TELEMETRY_ENABLED:-true}
  PYTHONPATH: "${PYTHONPATH}:/app/ColumnExtractor.py:/app/ConversationTracker.py:/app/Extractor.py:/app/UserExtractor.py:/app/Channel.py"

x-nginx-host-variables: &nginx-host-variables
  RASA_X_HOST: "rasa-x:5002"
  RASA_USER_APP: "app:5055"
  RASA_PRODUCTION_HOST: "rasa-production:5005"
  FASTAPI_HOST: "fastapi:8005"

x-rasa-services: &default-rasa-service
  restart: always
  build:
    context: .
  volumes:
      - ./.config:/.config
      - ./__init__.py:/app/__init__.py
      - ./ColumnExtractor.py:/app/ColumnExtractor.py
      - ./ConversationTracker.py:/app/ConversationTracker.py
      - ./Extractor.py:/app/Extractor.py
      - ./UserExtractor.py:/app/UserExtractor.py
      - ./data:/app/data
      - ./Channel.py:/app/Channel.py
  expose:
    - "5005"
  command: >
    x
    --no-prompt
    --production
    --config-endpoint http://rasa-x:5002/api/config?token=${RASA_X_TOKEN}
    --port 5005
    --jwt-method HS256
    --jwt-secret ${JWT_SECRET}
    --auth-token '${RASA_TOKEN}'
    --cors "*"
  depends_on:
    - rasa-x
    - rabbit
    - redis

services:

  rasa-production:
    <<: *default-rasa-service
    environment:
      <<: *rasa-credentials
      RASA_ENVIRONMENT: "production"
      DB_DATABASE: "tracker"
      MPLCONFIGDIR: "/tmp/.matplotlib"
      RASA_MODEL_SERVER: "http://rasa-x:5002/api/projects/default/models/tags/production"

  rasa-worker:
    <<: *default-rasa-service
    environment:
      <<: *rasa-credentials
      RASA_ENVIRONMENT: "worker"
      DB_DATABASE: "worker_tracker"
      MPLCONFIGDIR: "/tmp/.matplotlib"
      RASA_MODEL_SERVER: "http://rasa-x:5002/api/projects/default/models/tags/production"
      
  rasa-x:
    restart: always
    image: "rasa/rasa-x:${RASA_X_VERSION}"
    expose:
      - "5002"
    volumes:
      - ./models:/app/models
      - ./environments.yml:/app/environments.yml
      - ./credentials.yml:/app/credentials.yml
      - ./endpoints.yml:/app/endpoints.yml
      - ./logs:/logs
      - ./auth:/app/auth
      - ./__init__.py:/app/__init__.py
      - ./ColumnExtractor.py:/app/ColumnExtractor.py
      - ./ConversationTracker.py:/app/ConversationTracker.py
      - ./Extractor.py:/app/Extractor.py
      - ./UserExtractor.py:/app/UserExtractor.py
      - ./Channel.py:/app/Channel.py
    environment:
      <<: *database-credentials
      <<: *rasa-credentials
      SELF_PORT: "5002"
      DB_DATABASE: "${DB_DATABASE:-rasa}"
      RASA_MODEL_DIR: "/app/models"
      PASSWORD_SALT: ${PASSWORD_SALT}
      RABBITMQ_QUEUE: "rasa_production_events"
      RASA_X_USER_ANALYTICS: "0"
      SANIC_RESPONSE_TIMEOUT: "3600"
      RUN_DATABASE_MIGRATION_AS_SEPARATE_SERVICE: "true"
    depends_on:
      - db

  app:
    build: 
      context: actions
    volumes:
      - ./actions:/app/actions
      - ./data:/app/actions/data
    restart: always
    ports:
      - 5055:5055
    command: 'start --actions actions --auto-reload'

  fastapi:
    build:
      context: api
    volumes:
      - ./api/:/app/
      - ./data/tables:/app/tables/
      - ./data/conditions:/app/conditions/
      - ./data/users:/app/users/
    restart: always
    environment:
      PORT: 8005
    ports:
      - "8005:8005"
    command: ["uvicorn", "main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "8005"]


  nginx:
    restart: always
    image: "nginx:1.19"
    ports:
      - "80:8080"
      - "443:8443"
    volumes:
      - ./certs:/etc/certs
      - ./certs:/etc/nginx/certs
      - ./nginx-config-files/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx-config-files/ssl.conf.template:/etc/nginx/templates/ssl.conf.template
      - ./nginx-config-files/rasax.nginx.template:/etc/nginx/templates/rasax.nginx.template
    environment:
      <<: *nginx-host-variables
    depends_on:
      - rasa-x
      - rasa-production
      - app

  # logger:
  #   restart: always
  #   image: "rasa/logger:stable"
  #   command: ["/bin/sh", "-c", "docker-compose logs --no-color -f > /logs/compose_`date '+%Y-%m-%d_%H:%M:%S'`.log"]
  #   volumes:
  #     - ./logs:/logs
  #     - ./.env/:/home/ubuntu/chatbot/.env
  #     - ./docker-compose.yml:/home/ubuntu/chatbot/docker-compose.yml
  #     - /var/run/docker.sock:/var/run/docker.sock
  #   working_dir: /home/ubuntu/chatbot
  #   depends_on:
  #     - nginx