Poetry: command not found

Hello community, good morning.

Please help me with the following issue.

I’m trying to deploy a Python/Flask application that I uploaded to GitHub, but I’m encountering the following problem:

Apparently, Poetry has been installed, but it’s not being recognized.
I’m using Windows 10, VS Code, and the version of Poetry installed on my app is 1.8.3.

Tranks.

Poetry (1.7.1) is installed now. Great!

Aug 12 05:18:12 AM

Aug 12 05:18:12 AMTo get started you need Poetry’s bin directory (/opt/render/project/poetry/bin) in your PATH

Aug 12 05:18:12 AMenvironment variable.

Aug 12 05:18:12 AM

Aug 12 05:18:12 AMAdd export PATH="/opt/render/project/poetry/bin:$PATH" to your shell configuration file.

Aug 12 05:18:12 AM

Aug 12 05:18:12 AMAlternatively, you can call Poetry explicitly with /opt/render/project/poetry/bin/poetry.

Aug 12 05:18:12 AM

Aug 12 05:18:12 AMYou can test that everything is set up by executing:

Aug 12 05:18:12 AM

Aug 12 05:18:12 AMpoetry --version

Aug 12 05:18:12 AM

Aug 12 05:18:13 AM/home/render/envwrappers/poetry: line 80: poetry: command not found

Aug 12 05:18:13 AM==> Build failed :disappointed:

Literally just fallen over the same issue.

Aug 12 04:28:14 PM==> Installing dependencies from requirements.txt…
Aug 12 04:28:32 PM==> Using Python version 3.11.9 (default)
Aug 12 04:28:32 PM==> Docs on specifying a Python version: Setting Your Python Version – Render Docs
Aug 12 04:28:39 PM==> Using Poetry version 1.7.1 (default)
Aug 12 04:28:39 PM ==> Docs on specifying a Poetry version: Setting Your Poetry Version – Render Docs
Aug 12 04:28:39 PM ==> Installing Poetry version 1.7.1
Aug 12 04:29:01 PM Retrieving Poetry metadata
Aug 12 04:29:01 PM
Aug 12 04:29:01 PM# Welcome to Poetry!
Aug 12 04:29:01 PM
Aug 12 04:29:01 PM This will download and install the latest version of Poetry,
Aug 12 04:29:01 PM a dependency and package manager for Python.
Aug 12 04:29:01 PM It will add the poetry command to Poetry’s bin directory, located at:
Aug 12 04:29:01 PM /opt/render/project/poetry/bin
Aug 12 04:29:01 PM You can uninstall at any time by executing this script with the --uninstall option,
Aug 12 04:29:01 PM and these changes will be reverted.
Aug 12 04:29:01 PM Installing Poetry (1.7.1)
Aug 12 04:29:01 PM Installing Poetry (1.7.1): Creating environment
Aug 12 04:29:01 PM Installing Poetry (1.7.1): Installing Poetry
Aug 12 04:29:01 PM Installing Poetry (1.7.1): Creating script
Aug 12 04:29:01 PM Installing Poetry (1.7.1): Done
Aug 12 04:29:01 PM Poetry (1.7.1) is installed now. Great!
Aug 12 04:29:01 PM To get started you need Poetry’s bin directory (/opt/render/project/poetry/bin) in your PATH
Aug 12 04:29:01 PM environment variable.
Aug 12 04:29:01 PM Add export PATH="/opt/render/project/poetry/bin:$PATH" to your shell configuration file.
Aug 12 04:29:01 PM Alternatively, you can call Poetry explicitly with /opt/render/project/poetry/bin/poetry.
Aug 12 04:29:01 PM You can test that everything is set up by executing:
Aug 12 04:29:01 PM poetry --version
Aug 12 04:29:01 PM Ignoring asgiref: markers ‘python_version >= “3.12” and python_version < “4.0”’ don’t match your environment
Aug 12 04:29:01 PM Ignoring django: markers ‘python_version >= “3.12” and python_version < “4.0”’ don’t match your environment
Aug 12 04:29:01 PM Ignoring image: markers ‘python_version >= “3.12” and python_version < “4.0”’ don’t match your environment
Aug 12 04:29:01 PM Ignoring pillow: markers ‘python_version >= “3.12” and python_version < “4.0”’ don’t match your environment
Aug 12 04:29:01 PM Ignoring six: markers ‘python_version >= “3.12” and python_version < “4.0”’ don’t match your environment
Aug 12 04:29:01 PM Ignoring sqlparse: markers ‘python_version >= “3.12” and python_version < “4.0”’ don’t match your environment
Aug 12 04:29:01 PM Ignoring tzdata: markers ‘python_version >= “3.12” and python_version < “4.0” and sys_platform == “win32”’ don’t match your environment
Aug 12 04:29:02 PM [notice] A new release of pip is available: 24.0 → 24.2
Aug 12 04:29:02 PM [notice] To update, run: pip install --upgrade pip
Aug 12 04:29:02 PM ==> Running build command ‘poetry install && /opt/render/project/poetry/bin/poetry run yarn build’…
Aug 12 04:29:02 PM /home/render/envwrappers/poetry: line 80: poetry: command not found

solved it - putting the cart in front of the horse so to speak.

#!/bin/bash

Ensure Poetry is accessible in the current session

export PATH=“/opt/render/project/poetry/bin:$PATH”

Check for Poetry, and install it if not found

if ! command -v poetry &> /dev/null
then
echo “Poetry not found. Installing Poetry…”
curl -sSL https://install.python-poetry.org | python3 -
# Add Poetry to PATH for the current session
export PATH=“$HOME/.local/bin:$PATH”
else
echo “Poetry found: $(poetry --version)”
fi

Check that Poetry was successfully installed and is working

poetry --version
if [ $? -ne 0 ]; then
echo “Poetry installation failed.”
exit 1
fi

Install dependencies using Poetry

echo “Running poetry install…”
poetry install

Run the build process using Yarn via Poetry

echo “Running build process with Yarn…”
poetry run yarn build

Nice. Thank you very much. Problem solved.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.