Skip to content

Requests library module not found with latest version of rasa-sdk image #153

@karen-white

Description

@karen-white

Rasa version:
1.7.0
Rasa SDK version:
1.8.0
Python version:
3.6.9
Operating system (windows, osx, ...):
OSX
Issue:
Running custom action server code that imports the requests library throws an error when using the latest version of the rasa-sdk image. The module is found if you use the 1.7.0 version of the sdk image

Steps to reproduce:

  • Deploy assistant to a server using docker-compose
  • Create actions directory containing /actions.py and init.py
  • Add actions code to action.py file that imports requests library
  • Create docker-compose.override.yml file with the following:
version: '3.4'
services:
  app:
    image: 'rasa/rasa-sdk:latest'
    volumes:
      - './actions:/app/actions'
    expose:
      - '5005'
    depends_on:
      - rasa-production

Expected behavior:
Image should include the requests library

Actual behavior:
Returns error saying requests module is missing

Workaround:
Use custom action server image or rasa-sdk version 1.7

Error (including full traceback):

Traceback (most recent call last):
app_1              |   File "/app/rasa_sdk/executor.py", line 206, in register_package
app_1              |     self._import_submodules(package)
app_1              |   File "/app/rasa_sdk/executor.py", line 191, in _import_submodules
app_1              |     package = importlib.import_module(package)
app_1              |   File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
app_1              |     return _bootstrap._gcd_import(name[level:], package, level)
app_1              |   File "<frozen importlib._bootstrap>", line 994, in _gcd_import
app_1              |   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
app_1              |   File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
app_1              |   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
app_1              |   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
app_1              |   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
app_1              |   File "/app/actions/actions.py", line 6, in <module>
app_1              |     import requests
app_1              | ModuleNotFoundError: No module named 'requests'

Command or request that led to error:
Starting container after adding action server image

Content of configuration file (config.yml) (if relevant):

Content of domain file (domain.yml) (if relevant):

Contents of actions.py (if relevant):
https://github.com/RasaHQ/medicare-assistant/blob/master/actions.py
cc @alwx

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions