AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Docker file access reads from wrong directory instead of mounted workspace

Open psvensson opened this issue 2 years ago • 1 comments

⚠️ Search for existing issues first ⚠️

  • [X] I have searched the existing issues, and there is no existing issue for my problem

Which Operating System are you using?

Docker

Which version of Auto-GPT are you using?

Master (branch)

GPT-3 or GPT-4?

GPT-3.5

Steps to reproduce 🕹

Any action needing file access

Current behavior 😯

It always tries to look for files in the /app/autogpt/auto_gpt_workspace folder. There is nothing there. The mount is one level higher up. This is not a good thing.

Expected behavior 🤔

Default to accessing local files and folder at /app/auto_gpt_workspace This is where the workspace is actually mounted. This is a good thing

Your prompt 📝

# And prompt needing to read or write files from/to the local filesystem

Your Logs 📒

Developer  has been created with the following details:
Name:  Developer
Role:  An AI designed to develop back-end services and programs
Goals: 
-  Read instructions on what to do in the local file instructions.txt
-  Re-read this file for every 8 things you do, to refresh
-  Always return results as machine-readable and correct JSON
-  never execute_shell for any reason
Using memory of type:  RedisMemory
Using Browser:  chrome
 THOUGHTS:  I will start by reading the instructions from the local file instructions.txt
REASONING:  I need to know what tasks I am supposed to perform and how to perform them
PLAN: 
-  Read the instructions from the local file instructions.txt
CRITICISM:  None
NEXT ACTION:  COMMAND = read_file ARGUMENTS = {'filename': '/app/autogpt/auto_gpt_workspace/instructions.txt'}
Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands'n' to exit program, or enter feedback for ...
Input:y -12
-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-= 
SYSTEM:  Command read_file returned: Error: [Errno 2] No such file or directory: '/app/autogpt/auto_gpt_workspace/instructions.txt'
 THOUGHTS:  I need to create the instructions.txt file so that I can read the instructions for what tasks to perform
REASONING:  The instructions.txt file is necessary for me to know what tasks to perform and how to perform them. Since it does not exist, I need to create it first.
....
.... <chaos ensues>
...

psvensson avatar Apr 26 '23 07:04 psvensson

Slammed my head on this one as well for a few hours.

Workaround attempt:

Adjusted WORKSPACE_PATH in workspace.py, and added a BASE_PATH to Dockerfile. Unfortunately, it still seems to be unable to locate any files in /app/auto_gpt_workspace/. New to Docker so likely overlooking something.

Dockerfile # Set environment variables ENV PIP_NO_CACHE_DIR=yes \ PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ BASE_PATH=/app

workspace.py BASE_PATH = Path(os.environ["BASE_PATH"]) WORKSPACE_PATH = BASE_PATH / "auto_gpt_workspace"

output

NEXT ACTION: COMMAND = read_file ARGUMENTS = {'file': 'basic_sorts.py'} Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for ... Input:y -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-= SYSTEM: Command read_file returned: Error: [Errno 2] No such file or directory: '/app/auto_gpt_workspace/basic_sorts.py'

EDIT: Moving auto_gpt_workspace to autogpt folder along with env changes mentioned above is workaround for this issue and allows reading/writing to files in docker.

ColbyLeeCode avatar Apr 26 '23 07:04 ColbyLeeCode

Closing as duplicate of #2290

Pwuts avatar Apr 26 '23 20:04 Pwuts