Skip to content

bug: bentoml not found when using command: ["bentoml"] due to missing venv path in $PATH #5310

@restato

Description

@restato

Describe the bug

When deploying a Bento container to Kubernetes with a command: ["bentoml", "serve"], the container fails to start with the following error:

OCI runtime create failed: exec: “bentoml”: executable file not found in $PATH

This happens because in the current container setup, bentoml is installed inside the virtual environment (/app/.venv/bin/bentoml), but that path is not included in the default $PATH during container startup via exec.

While the bentoml binary is discoverable inside a shell (kubectl exec shows it in $PATH), it is not available during exec-style entrypoint execution, which Kubernetes uses for command.

Expected behavior

The container should be able to run bentoml directly via:

command: ["bentoml", "serve"]

Without requiring users to hardcode absolute paths like /app/.venv/bin/bentoml, or manually inject the virtualenv path into PATH.

Proposed solution

In the generated Dockerfile template

ENV PATH="/app/.venv/bin:$PATH"

This ensures the virtual environment’s bin directory is available in $PATH during container startup, including in exec-style runtimes (like K8s).

Additional context
• This issue didn’t occur in previous version (1.2.20) where bentoml was installed into /usr/local/bin.
• It’s especially impactful for Helm chart users and Kubernetes environments where command: is overridden.

Let me know if you’d like me to submit a PR for this. Happy to contribute!

To reproduce

No response

Expected behavior

No response

Environment

Using Python 3.13.2 environment at: serving/.venv

Environment variable

BENTOML_DEBUG=''
BENTOML_QUIET=''
BENTOML_BUNDLE_LOCAL_BUILD=''
BENTOML_DO_NOT_TRACK=''
BENTOML_CONFIG=''
BENTOML_CONFIG_OPTIONS=''
BENTOML_PORT=''
BENTOML_HOST=''
BENTOML_API_WORKERS=''

System information

bentoml: 1.4.8
python: 3.13.2
platform: macOS-15.3.2-arm64-arm-64bit-Mach-O
uid_gid: 501:20

pip_packages
a2wsgi==1.10.8
aiohappyeyeballs==2.6.1
aiohttp==3.11.16
aiosignal==1.3.2
aiosqlite==0.21.0
annotated-types==0.7.0
anyio==4.9.0
appdirs==1.4.4
asgiref==3.8.1
attrs==25.3.0
bentoml==1.4.8
cattrs==23.1.2
certifi==2025.1.31
click==8.1.8
click-option-group==0.5.7
cloudpickle==3.1.1
deprecated==1.2.18
frozenlist==1.5.0
fs==2.4.16
h11==0.14.0
httpcore==1.0.7
httpx==0.28.1
httpx-ws==0.7.2
idna==3.10
importlib-metadata==8.6.1
iniconfig==2.1.0
jinja2==3.1.6
kantoku==0.18.3
markdown-it-py==3.0.0
markupsafe==3.0.2
mdurl==0.1.2
multidict==6.3.2
numpy==2.2.4
nvidia-ml-py==12.570.86
opentelemetry-api==1.31.1
opentelemetry-instrumentation==0.52b1
opentelemetry-instrumentation-aiohttp-client==0.52b1
opentelemetry-instrumentation-asgi==0.52b1
opentelemetry-sdk==1.31.1
opentelemetry-semantic-conventions==0.52b1
opentelemetry-util-http==0.52b1
packaging==24.2
pathspec==0.12.1
pillow==11.1.0
pip-requirements-parser==32.0.1
pluggy==1.5.0
prometheus-client==0.21.1
prompt-toolkit==3.0.50
propcache==0.3.1
psutil==7.0.0
pydantic==2.11.2
pydantic-core==2.33.1
pygments==2.19.1
pyparsing==3.2.3
pytest==8.3.5
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
python-json-logger==3.3.0
python-multipart==0.0.20
pyyaml==6.0.2
pyzmq==26.4.0
questionary==2.1.0
rich==14.0.0
ruff==0.11.4
schema==0.7.7
setuptools==78.1.0
simple-di==0.1.5
six==1.17.0
sniffio==1.3.1
starlette==0.46.1
tomli-w==1.2.0
tornado==6.4.2
typing-extensions==4.13.1
typing-inspection==0.4.0
uvicorn==0.34.0
watchfiles==1.0.5
wcwidth==0.2.13
wrapt==1.17.2
wsproto==1.2.0
yarl==1.19.0
zipp==3.21.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions