Skip to content

Commit

Permalink
fix: permission issue of uv python installation directory (#5151)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostming authored Dec 26, 2024
1 parent 116389c commit 8d4b785
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/_bentoml_sdk/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def get_image_from_build_config(build_config: BentoBuildConfig) -> Image | None:
"conda options are not supported by bento v2, fallback to bento v1"
)
return None
image = PythonImage()
docker_options = build_config.docker
if docker_options.cuda_version is not None:
logger.warning(
Expand All @@ -208,12 +207,14 @@ def get_image_from_build_config(build_config: BentoBuildConfig) -> Image | None:
"docker.setup_script is not supported by bento v2, fallback to bento v1"
)
return None
image_params = {}
if docker_options.base_image is not None:
image.base_image = docker_options.base_image
image_params["base_image"] = docker_options.base_image
if docker_options.distro is not None:
image.distro = docker_options.distro
image_params["distro"] = docker_options.distro
if docker_options.python_version is not None:
image.python_version = docker_options.python_version
image_params["python_version"] = docker_options.python_version
image = PythonImage(**image_params)
if docker_options.system_packages:
image.system_packages(*docker_options.system_packages)

Expand Down
4 changes: 2 additions & 2 deletions src/bentoml/_internal/configuration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def is_editable_bentoml() -> bool:

dist = importlib.metadata.distribution("bentoml")
direct_url_file = next(
(f for f in (dist.files or []) if f.name == "direct_url.json"), None
(f for f in (dist.files or []) if str(f).endswith("direct_url.json")), None
)
if direct_url_file is None:
return False
Expand All @@ -84,7 +84,7 @@ def get_bentoml_requirement() -> str | None:
"""Returns the requirement string for BentoML."""
dist = importlib.metadata.distribution("bentoml")
direct_url_file = next(
(f for f in (dist.files or []) if f.name == "direct_url.json"), None
(f for f in (dist.files or []) if str(f).endswith("direct_url.json")), None
)
if direct_url_file is None:
return f"bentoml=={BENTOML_VERSION}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ WORKDIR $BENTO_PATH
RUN {{ command }}
{% endfor %}

RUN pip install uv && uv venv --python {{ __options__python_version }} /app/.venv
RUN pip install uv && UV_PYTHON_INSTALL_DIR=/app/python/ uv venv --python {{ __options__python_version }} /app/.venv
ENV VIRTUAL_ENV=/app/.venv
{% set __pip_cache__ = common.mount_cache("/root/.cache/") %}
{% if __pip_preheat_packages__ %}
Expand Down

0 comments on commit 8d4b785

Please sign in to comment.