OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

setup-config error 'read' is not recognized W/ possible sollution code

Open ArtisticMusician opened this issue 1 year ago • 1 comments

Describe the bug


#### Setup and configuration
**Current version**:
<!-- run `git log -n 1` to see this -->

commit 66031a67ba86cad6fc6f1efa4653a93eccb4b4ab (HEAD -> main, origin/main, origin/HEAD) Author: Engel Nyst [email protected] Date: Wed Apr 3 22:28:56 2024 +0200


    Make max_iterations configurable (#676)

```bash

My config.toml and environment vars (be sure to redact API keys): Windows11 with WSL ubuntu 22.04 Anaconda with python 3.11 on that env.

My model and agent (you can see these settings in the UI):

  • Model:
  • Agent:

Commands I ran to install and run OpenDevin:

Steps to Reproduce:

  1. run 'make setup-congfig' command

make setup-config "Setting up config.toml..." 'read' is not recognized as an internal or external command, operable program or batch file. make: *** [Makefile:45: setup-config] Error 1-->:

Additional Context

I believe this is a solution

# Makefile for OpenDevin project

# Variables
DOCKER_IMAGE = ghcr.io/opendevin/sandbox
BACKEND_PORT = 3000
BACKEND_HOST = "127.0.0.1:$(BACKEND_PORT)"
FRONTEND_PORT = 3001
DEFAULT_WORKSPACE_DIR = "./workspace"
DEFAULT_MODEL = "gpt-4-0125-preview"
CONFIG_FILE = config.toml

# Build
build:
	@echo "Building project..."
	@echo "Pulling Docker image..."
	@docker pull $(DOCKER_IMAGE)
	@echo "Installing Python dependencies..."
	@python -m pip install pipenv
	@python -m pipenv install -v
	@echo "Setting up frontend environment..."
	@cd frontend && npm install

# Start backend
start-backend:
	@echo "Starting backend..."
	@python -m pipenv run uvicorn opendevin.server.listen:app --port $(BACKEND_PORT)

# Start frontend
start-frontend:
	@echo "Starting frontend..."
	@cd frontend && BACKEND_HOST=$(BACKEND_HOST) FRONTEND_PORT=$(FRONTEND_PORT) npm run start

# Run the app
run:
	@echo "Running the app..."
	@mkdir -p logs
	@rm -f logs/pipe
	@mkfifo logs/pipe
	@cat logs/pipe | (make start-backend) &
	@echo  'test' | tee logs/pipe | (make start-frontend)

# Setup config.toml
setup-config:
	@echo "Setting up config.toml..."
	@set /p llm_model="Enter your LLM Model name (see docs.litellm.ai/docs/providers for full list) [default: $(DEFAULT_MODEL)]: " && echo LLM_MODEL=%llm_model% >> $(CONFIG_FILE).tmp
	@set /p llm_api_key="Enter your LLM API key: " & echo LLM_API_KEY="%llm_api_key%" >> $(CONFIG_FILE).tmp
	@set /p workspace_dir="Enter your workspace directory [default: $(DEFAULT_WORKSPACE_DIR)]: " && set workspace_dir=%workspace_dir:-$(DEFAULT_WORKSPACE_DIR)% && echo WORKSPACE_DIR="%workspace_dir%" >> $(CONFIG_FILE).tmp
	@move $(CONFIG_FILE).tmp $(CONFIG_FILE)

# Help
help:
	@echo "Usage: make [target]"
	@echo "Targets:"
	@echo "  build                 - Build project, including environment setup and dependencies."
	@echo "  start-backend         - Start the backend server for the OpenDevin project."
	@echo "  start-frontend        - Start the frontend server for the OpenDevin project."
	@echo "  run                 - Run the OpenDevin application, starting both backend and frontend servers."
	@echo "                        Backend Log file will be stored in the 'logs' directory."
	@echo "  setup-config         - Setup the configuration for OpenDevin by providing LLM API key, LLM Model name, and workspace directory."
	@echo "  help                 - Display this help message, providing information on available targets."

# Phony targets
.PHONY: install start-backend start-frontend run setup-config help

ArtisticMusician avatar Apr 03 '24 23:04 ArtisticMusician

You env cannot recognize read command. It is a build-in command in shell.

yufansong avatar Apr 04 '24 21:04 yufansong

@ArtisticMusician you need to run the commands inside WSL for the makefile to work. The "not recognized" message you're getting is a Windows error message. https://stackoverflow.com/questions/48321639/error-is-not-recognized-as-an-internal-or-external-command-operable-program-o

rbren avatar Apr 07 '24 22:04 rbren