fix: Fix poetry env issues with the agent's entrypoint scripts

- Update autogpt.bat to use `poetry install` instead of `%PYTHON_CMD% -m poetry install`
- Update autogpt.sh to use `poetry install` instead of `$PYTHON_CMD -m poetry install`
- Use `poetry run` to execute the `autogpt` command in both scripts
This commit is contained in:
Reinier van der Leer
2023-12-02 14:14:35 +01:00
parent 4bcfe72485
commit 6743636996
2 changed files with 10 additions and 12 deletions

View File

@@ -2,7 +2,7 @@
setlocal enabledelayedexpansion
:FindPythonCommand
for %%A in (python python3) do (
for %%A in (python3 python) do (
where /Q %%A
if !errorlevel! EQU 0 (
set "PYTHON_CMD=%%A"
@@ -18,10 +18,10 @@ exit /B 1
%PYTHON_CMD% scripts/check_requirements.py
if errorlevel 1 (
echo
%PYTHON_CMD% -m poetry install --without dev
poetry install --without dev
echo
echo Finished installing packages! Starting AutoGPT...
echo
)
%PYTHON_CMD% -m autogpt %*
poetry run autogpt %*
pause

View File

@@ -1,12 +1,12 @@
#!/usr/bin/env bash
function find_python_command() {
if command -v python &> /dev/null
then
echo "python"
elif command -v python3 &> /dev/null
if command -v python3 &> /dev/null
then
echo "python3"
elif command -v python &> /dev/null
then
echo "python"
else
echo "Python not found. Please install Python."
exit 1
@@ -16,16 +16,14 @@ function find_python_command() {
PYTHON_CMD=$(find_python_command)
if $PYTHON_CMD -c "import sys; sys.exit(sys.version_info < (3, 10))"; then
$PYTHON_CMD scripts/check_requirements.py
if [ $? -eq 1 ]
then
if ! $PYTHON_CMD scripts/check_requirements.py; then
echo
$PYTHON_CMD -m poetry install --without dev
poetry install --without dev
echo
echo "Finished installing packages! Starting AutoGPT..."
echo
fi
$PYTHON_CMD -m autogpt "$@"
poetry run autogpt "$@"
else
echo "Python 3.10 or higher is required to run Auto GPT."
fi