Hello everyone! I'm trying to setup pants on a mon...
# general
w
Hello everyone! I'm trying to setup pants on a monorepo project where we currently had multiple pyprojet.toml files I'm running into an issue for a service that depends on some python modules that need cmake and build-essential to be installed. I have tried creating a docker_image with cmake and build-essential, then using it as docker_environment, but this doesn't work, I get error while trying to package I have the following:
Copy code
docker_image(
  name="cmake_image",
  repository="cmake_image",
  image_tags=["cmake"],
  build_platform = ["linux/amd64"],
  instructions=[
    "FROM python:3.11-slim-bullseye@sha256:f1eb0acc757e945800c4abb56e24f0e69a19db7a9c9e77d57ff27531cd639003",
    "RUN apt-get update && apt-get install -y --no-install-recommends unzip cmake build-essential",
  ],
  skip_push=True,
)

docker_environment(
  name="cmake_environment",
  platform="linux_x86_64",
  image="cmake_image:cmake",
)
and
Copy code
python_aws_lambda_function(
  name="lambda",
  handler="handler.py:handler",
  environment = "cmake",
  dependencies=[
    "//python:cmake_image",
  ],
  complete_platforms=["//python:linux_x86_64"],
)
And I get a build error like
CMake build failed
× Building wheel for llama_cpp_python (pyproject.toml) did not run successfully.
Note that the same occurs with a pex_binary goal Is there a proper way of doing what I'm trying to achieve?
h
If I’m reading this correctly, the cmake build inside the environment is what is failing?
What are your relevant pants.toml settings BTW?
If you could set up a small repo that reproduces the issue that would be helpful
w
Yes, I think that's the error, and I'm probably not doing this the right way. I will try to create a small repo later today Basically what I'm trying to do is find a way to build (from my macbook) a lambda function with semantic-router and semantic-chunkers installed
h
@broad-processor-92400 is probably the top expert on this sort of thing ATM
b
Using a
docker_image
as direct input to a
docker_environment
doesn't work as far as I know: https://github.com/pantsbuild/pants/issues/17714 You'll need to build the image separately and then use it in the environment