build error running python activating venv and installing requirements.txt

beballod
FREE

10 days ago

Trying to fix this error. Thanks for any pointers.

Here's the command: "python -m venv --copies /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt" did not complete successfully: exit code: 127

And error code: /bin/bash: line 1: python: command not found

Solved$10 Bounty

2 Replies

9 days ago

This probably means that python is not installed or not in your path.

Depending on your image maybe python is installed as python3 so you may try with

python3 -m venv --copies /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt or install python-is-python3

Try to find out with which python and If python is installed just add it to your path export PATH="/path/to/python/bin:$PATH"

I would also recommend better using UV to run python within containers, is super easy and cool.

FROM python:3.12-slim-bookworm

COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

Then uv run python -m etc.


roicort

This probably means that python is not installed or not in your path.Depending on your image maybe python is installed as python3 so you may try withpython3 -m venv --copies /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt or install python-is-python3Try to find out with which python and If python is installed just add it to your path export PATH="/path/to/python/bin:$PATH"I would also recommend better using UV to run python within containers, is super easy and cool.FROM python:3.12-slim-bookwormCOPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/Then uv run python -m etc.

beballod
FREE

8 days ago

This pointed me in the right direction and it's working now...thanks for the quick reply!

I'll check out UV.


Status changed to Solved chandrika 8 days ago