bentoml / bentoctl

Fast model deployment on any cloud 🚀
https://bentoml.com
Other
175 stars 30 forks source link

bentoctl build & deployment results in "NoCredentialsError" #205

Closed SLong97 closed 1 year ago

SLong97 commented 1 year ago

I don't believe this is an issue with bentoctl but I was wondering if anyone ran into a similar issue or could provide some insight as to why I am getting a "NoCredentialsError".

I do believe I have setup my credentials correctly for aws cli, my "~/.aws/credentials" file is all in order and contains the correct access key ID and secret key for the root user.

Here is what I get from "aws configure list"

sean@sean-virtual-machine:~$ aws configure list
      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                <not set>             None    None
access_key     ****************3K4C shared-credentials-file    
secret_key     ****************xr7H shared-credentials-file    
    region                eu-west-1      config-file    ~/.aws/config

And here is the error I get when I run bentoctl build -b speech_to_text_pipeline:zxhpm6voggcmit6i -f deployment_config.yaml

sean@sean-virtual-machine:~$ sudo /home/sean/Documents/PodNotes/pnenv/bin/bentoctl build -b speech_to_text_pipeline:zxhpm6voggcmit6i -f deployment_config.yaml
[sudo] password for sean: 
/home/sean/Documents/PodNotes/pnenv/bin/bentoctl:5: DeprecationWarning: bentoml._internal.utils.buildx is deprecated. Make sure to use 'bentoml.container.build' and 'bentoml.container.health' instead.
  from bentoctl.cli import bentoctl
Multiple '--platform' arguments were found. Make sure to also use '--push' to push images to a repository or generated images will not be saved. See https://docs.docker.com/engine/reference/commandline/buildx_build/#load.
[+] Building 1.4s (20/20) FINISHED                                                                                                                                                                         
 => [internal] load .dockerignore                                                                                                                                                                     0.1s
 => => transferring context: 2B                                                                                                                                                                       0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                  0.0s
 => => transferring dockerfile: 2.34kB                                                                                                                                                                0.0s
 => [internal] load metadata for docker.io/nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu20.04                                                                                                              1.3s
 => [ 1/15] FROM docker.io/nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu20.04@sha256:42c57730e6d677799ebe09bbe007f6f21447cfda2d5a7d40f2a34e3979f4bd30                                                      0.0s
 => [internal] load build context                                                                                                                                                                     0.0s
 => => transferring context: 872B                                                                                                                                                                     0.0s
 => CACHED [ 2/15] RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache                                             0.0s
 => CACHED [ 3/15] RUN set -eux &&     apt-get update -y &&     apt-get install -q -y --no-install-recommends --allow-remove-essential         ca-certificates gnupg2 bash build-essential git ffmpe  0.0s
 => CACHED [ 4/15] RUN     set -eux &&     apt-get install -y --no-install-recommends --allow-remove-essential software-properties-common &&     add-apt-repository ppa:deadsnakes/ppa &&     apt-ge  0.0s
 => CACHED [ 5/15] RUN ln -sf /usr/bin/python3.10 /usr/bin/python3 &&     ln -sf /usr/bin/pip3.10 /usr/bin/pip3                                                                                       0.0s
 => CACHED [ 6/15] RUN curl -O https://bootstrap.pypa.io/get-pip.py &&     python3 get-pip.py &&     rm -rf get-pip.py                                                                                0.0s
 => CACHED [ 7/15] RUN groupadd -g 1034 -o bentoml && useradd -m -u 1034 -g 1034 -o -r bentoml                                                                                                        0.0s
 => CACHED [ 8/15] RUN mkdir /home/bentoml/bento && chown bentoml:bentoml /home/bentoml/bento -R                                                                                                      0.0s
 => CACHED [ 9/15] WORKDIR /home/bentoml/bento                                                                                                                                                        0.0s
 => CACHED [10/15] COPY --chown=bentoml:bentoml . ./                                                                                                                                                  0.0s
 => CACHED [11/15] RUN bash -euxo pipefail /home/bentoml/bento/env/python/install.sh                                                                                                                  0.0s
 => CACHED [12/15] RUN chmod +x /home/bentoml/bento/env/docker/setup_script                                                                                                                           0.0s
 => CACHED [13/15] RUN /home/bentoml/bento/env/docker/setup_script                                                                                                                                    0.0s
 => CACHED [14/15] RUN rm -rf /var/lib/{apt,cache,log}                                                                                                                                                0.0s
 => CACHED [15/15] RUN chmod +x /home/bentoml/bento/env/docker/entrypoint.sh                                                                                                                          0.0s
 => exporting to image                                                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                                                               0.0s
 => => writing image sha256:fe0c8a590e9660aea0f829d4bace7bd17466dccc81ac87cbe462ea3f2f5ecb44                                                                                                          0.0s
 => => naming to docker.io/library/aws-ec2-speech_to_text_pipeline:zxhpm6voggcmit6i                                                                                                                   0.0s
Traceback (most recent call last):
  File "/home/sean/Documents/PodNotes/pnenv/bin/bentoctl", line 8, in <module>
    sys.exit(bentoctl())
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/bentoctl/cli/utils.py", line 90, in wrapper
    return_value = func(*args, **kwargs)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/bentoctl/cli/utils.py", line 55, in wrapper
    return func(*args, **kwargs)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/bentoctl/cli/utils.py", line 24, in wrapper
    return func(*args, **kwargs)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/bentoctl/cli/__init__.py", line 158, in build
    ) = deployment_config.create_repository()
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/bentoctl/deployment_config.py", line 217, in create_repository
    (repository_url, username, password,) = self.operator.create_repository(
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/bentoctl/operator/operator.py", line 150, in create_repository
    return operator.create_repository(repository_name, operator_spec)
  File "/root/bentoctl/operators/aws-ec2/bentoctl_aws_ec2/registry_utils.py", line 44, in create_repository
    repo_id, _ = create_ecr_repository_if_not_exists(
  File "/root/bentoctl/operators/aws-ec2/bentoctl_aws_ec2/registry_utils.py", line 30, in create_ecr_repository_if_not_exists
    result = ecr_client.describe_repositories(repositoryNames=[repository_name])
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/botocore/client.py", line 530, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/botocore/client.py", line 943, in _make_api_call
    http, parsed_response = self._make_request(
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/botocore/client.py", line 966, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/botocore/endpoint.py", line 119, in make_request
    return self._send_request(request_dict, operation_model)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/botocore/endpoint.py", line 198, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/botocore/endpoint.py", line 134, in create_request
    self._event_emitter.emit(
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/botocore/hooks.py", line 412, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/botocore/hooks.py", line 256, in emit
    return self._emit(event_name, kwargs)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/botocore/hooks.py", line 239, in _emit
    response = handler(**kwargs)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/botocore/signers.py", line 105, in handler
    return self.sign(operation_name, request)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/botocore/signers.py", line 189, in sign
    auth.add_auth(request)
  File "/home/sean/Documents/PodNotes/pnenv/lib/python3.10/site-packages/botocore/auth.py", line 418, in add_auth
    raise NoCredentialsError()
botocore.exceptions.NoCredentialsError: Unable to locate credentials
sean@sean-virtual-machine:~$ 

Any help would be appreciated and apologies if this isn't the right place for this query.

aarnphm commented 1 year ago

I suggest using the AWS environment variable and trying again.

SLong97 commented 1 year ago

@aarnphm I'm afraid that didn't resolve my problem

SLong97 commented 1 year ago

The issue has been resolved, I needed neither sudo nor the path to bentoctl /home/sean/Documents/PodNotes/pnenv/bin/bentoctl

aarnphm commented 1 year ago

Oh i didn't realize you are running sudo. My b.