FileNotFoundError: [Errno 2]

I have Rasa X installed on my own server connected to GitHub where I have all my chatbot data. When I try to run docker-compose up I get this error:

action_server_1    | Traceback (most recent call last):
action_server_1    |   File "/usr/local/lib/python3.6/", line 193, in _run_module_as_main
action_server_1    |     "__main__", mod_spec)
action_server_1    |   File "/usr/local/lib/python3.6/", line 85, in _run_code
action_server_1    |     exec(code, run_globals)
action_server_1    |   File "/app/rasa_sdk/", line 33, in <module>
action_server_1    |     main()
action_server_1    |   File "/app/rasa_sdk/", line 29, in main
action_server_1    |     main_from_args(cmdline_args)
action_server_1    |   File "/app/rasa_sdk/", line 20, in main_from_args
action_server_1    |     args.ssl_password,
action_server_1    |   File "/app/rasa_sdk/", line 116, in run
action_server_1    |     app = create_app(action_package_name, cors_origins=cors_origins)
action_server_1    |   File "/app/rasa_sdk/", line 68, in create_app
action_server_1    |     executor.register_package(action_package_name)
action_server_1    |   File "/app/rasa_sdk/", line 222, in register_package
action_server_1    |     self.register_action(action)
action_server_1    |   File "/app/rasa_sdk/", line 157, in register_action
action_server_1    |     action = action()
action_server_1    |   File "/app/actions/", line 631, in __init__
action_server_1    |     self.intent_mappings = pd.read_csv("./data/intent_description_mapping.csv")
action_server_1    |   File "/usr/local/lib/python3.6/site-packages/pandas/io/", line 685, in parser_f
action_server_1    |     return _read(filepath_or_buffer, kwds)
action_server_1    |   File "/usr/local/lib/python3.6/site-packages/pandas/io/", line 457, in _read
action_server_1    |     parser = TextFileReader(fp_or_buf, **kwds)
action_server_1    |   File "/usr/local/lib/python3.6/site-packages/pandas/io/", line 895, in __init__
action_server_1    |     self._make_engine(self.engine)
action_server_1    |   File "/usr/local/lib/python3.6/site-packages/pandas/io/", line 1135, in _make_engine
action_server_1    |     self._engine = CParserWrapper(self.f, **self.options)
action_server_1    |   File "/usr/local/lib/python3.6/site-packages/pandas/io/", line 1917, in __init__
action_server_1    |     self._reader = parsers.TextReader(src, **kwds)
action_server_1    |   File "pandas/_libs/parsers.pyx", line 382, in pandas._libs.parsers.TextReader.__cinit__
action_server_1    |   File "pandas/_libs/parsers.pyx", line 689, in pandas._libs.parsers.TextReader._setup_parser_source
action_server_1    | FileNotFoundError: [Errno 2] File b'data/intent_description_mapping.csv' does not exist: b'data/intent_description_mapping.csv'

However I do have the file intent_description_mapping.csv both in my server directory and in GitHub. How can I fix it?

Thank you, Tiziano

I looks like your action server container can’t file your CSV file. How have you configured the action server container? Are you using a docker-compose.override.yml file?

I just followed the main guide. Yes I do use a docker-compose.override.yml file.

Perfect - could you share the contents of that file here?

Sure, I just copied what the guide said:

version: '3.4'
    image: pandasimg:latest

pandasimg is my custom image that I had to create in order to add custom dependencies (as explained here.

Ok - when you create your image, are you using COPY in the Dockerfile to add your CSV file into the image?

No, this is my Dockerfile:

# Extend the official Rasa SDK image
FROM rasa/rasa-sdk:latest

# Add a custom python library (e.g. jupyter)
RUN pip install --no-cache-dir pandas

Can you please explain me better how should I edit it?

Sure: when you’re creating your Docker image, you can add files to it from your current directory. To do this, use the COPY command. So in your case, it’ll probably look like this:

COPY intent_description_mapping.csv data/

This will copy your local file to the container’s data/ directory. Depending on where your file is locally, you may need to change the first path. Try different options and see what works.

Ok, I’ll try it soon and let you know, thank you!

What I still don’t understand is why some files that are in my GitHub repository don’t need to be copied to my server (such as domain, stories, etc.) and certain others like this one need to… Couldn’t it just retrieve intent_description_mapping.csv from GitHub the same way it does with all the other files?

I suppose you’re using Integrated Version Control to manage your project files. The version control only works for domain, stories, NLU files etc. (like you mentioned). Because the action server is a separate server than the main Rasa X server, its files need to be managed separately. For the moment, the only way to do that is through copying files into the action server container.

Alright, thank you. Btw your solution works, thank you very much :slightly_smiling_face:

1 Like

When you open a file with the file name , you are telling the open() function that your file is in the current working directory. This is called a relative path. If the user does not pass the full path to the file (on Unix type systems this means a path that starts with a slash), the path is interpreted relatively to the current working directory. The current working directory usually is the directory in which you started the program. A good start would be validating the input. In other words, you can make sure that the user has indeed typed a correct path for a real existing file, like this:

while not os.path.isfile(fileName):
    fileName = input("Whoops! No such file! Please enter the name of the file you'd like to use.")

Another way to tell the python file open() function where your file is located is by using an absolute path, e.g.:

f = open("/Users/foo/filename")