bentoctl icon indicating copy to clipboard operation
bentoctl copied to clipboard

build fails with no such file or directory

Open hade94 opened this issue 1 year ago • 2 comments

Hi,

when building a dockerized image of a bento an error accurred. To Reproduce

Steps to reproduce the issue: bentoctl build -b summarization:latest

Expected behavior Builds the docker image

pip install bentoctl==0.3.4 fixes this issue temporally

Screenshots/Logs

In debug mode. Intermediate bento saved to /tmp/bentoctl-temp-3bbhxx8b
Traceback (most recent call last):
  File "/home/loginuser/anaconda3/envs/bentoml/bin/bentoctl", line 8, in <module>
    sys.exit(bentoctl())
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/site-packages/bentoctl/cli/utils.py", line 92, in wrapper
    return_value = func(*args, **kwargs)
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/site-packages/bentoctl/cli/utils.py", line 57, in wrapper
    return func(*args, **kwargs)
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/site-packages/bentoctl/cli/utils.py", line 26, in wrapper
    return func(*args, **kwargs)
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/site-packages/bentoctl/cli/__init__.py", line 316, in build
    generate_deployable_container(
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/site-packages/bentoctl/docker_utils.py", line 120, in generate_deployable_container
    backend.build(**buildx_args)
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/site-packages/bentoml/_internal/container/base.py", line 186, in build
    return subprocess.check_output(commands, cwd=context_path, env=env)
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/home/loginuser/anaconda3/envs/bentoml/lib/python3.9/subprocess.py", line 1837, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmphhd9d2uxfsTempFS/'

Environment:

  • OS: Ubuntu 22.04.2 LTS
  • Python Version 3.9 (conda)
  • BentoML Version 1.1.7
  • Bentoctl Version 0.4.0
  • Docker version 24.0.5, build ced0996

Additional context bentoml/azure-container-instances-deploy#10

hade94 avatar Oct 20 '23 10:10 hade94

Hey I have the same, bug. Did you fix the issue please ?

BaptisteLoquette avatar Nov 22 '23 14:11 BaptisteLoquette

Hello @BaptisteLoquette @hade94 , you can reinstall 0.4.0 and make the changes I proposed in the MR here : https://github.com/bentoml/bentoctl/pull/214

What happens with version 0.3.4 is that the models are not copied in the image built, that's why they are not found in your setup.

In version 0.4.0, the context manager supposed to create a temporary file system containing the bento with his models is not passed to the aws-ec2 operator, thus the operator does not find the "/tmp/xxxx" folder containing the bento to build the image.

With the changes above, the models will be copied in the bento and the image will be correctly built.

michaelromagne avatar Dec 02 '23 17:12 michaelromagne