0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

guidance-for-claude-code-with-amazon-bedrock 利用時メモ

0
Last updated at Posted at 2026-04-18

はまり個所

Claude Code にEntra認証を掛けるため、guidance-for-claude-code-with-amazon-bedrockというツールを利用。
ツールのパッケージングは成功しても、実際に利用するとエラー(Error: No module named '_cffi_backend' 他多数)が多発して使えない状況に陥った。

ビルド環境はDockerを利用して組み込んであるので、エラーの指す依存性を追加していったところ動いた。
その際の追加内容を記録する。

  • guidance-for-claude-code-with-amazon-bedrock/source/claude_code_with_bedrock/cli/commands/package.py L915

    ・・・FROM --platform={docker_platform} ubuntu:22.04
    
    # Set non-interactive to avoid tzdata prompts
    ENV DEBIAN_FRONTEND=noninteractive
    ENV TZ=UTC
    
    # Install Python 3.12 and build dependencies
    RUN apt-get update && apt-get install -y \
        software-properties-common \
        build-essential \
        binutils \
        curl \
        && add-apt-repository -y ppa:deadsnakes/ppa \
        && apt-get update \
        && apt-get install -y python3.12 python3.12-dev python3.12-venv \
        && rm -rf /var/lib/apt/lists/*
    
    # Create a virtual environment to isolate from Ubuntu's system packages
    RUN python3.12 -m venv /opt/venv
    ENV PATH="/opt/venv/bin:$PATH"
    
    # Upgrade core build tools inside the venv
    RUN pip install --no-cache-dir --upgrade pip setuptools wheel
    
    # Install Python packages inside the venv
    RUN pip install --no-cache-dir \
        pyinstaller \
        boto3 \
        requests \
        PyJWT \
        cryptography \
        cffi \
        keyring \
        keyrings.alt \
        questionary \
        rich \
        cleo \
        pydantic \
        pyyaml \
        six==1.16.0 \
        python-dateutil \
        appdirs
    
    # Set working directory
    WORKDIR /build
    
    # Copy source code
    COPY credential_provider /build/credential_provider
    
    # Build the binary with PyInstaller
    RUN pyinstaller \
        --onefile \
        --clean \
        --noconfirm \
        --name {binary_name} \
        --distpath /output \
        --workpath /tmp/build \
        --specpath /tmp \
        --log-level WARN \
        --hidden-import keyring.backends.SecretService \
        --hidden-import keyring.backends.chainer \
        --hidden-import six \
        --hidden-import six.moves \
        --hidden-import six.moves._thread \
        --hidden-import six.moves.urllib \
        --hidden-import six.moves.urllib.parse \
        --hidden-import dateutil \
        --hidden-import _cffi_backend \
        --hidden-import appdirs \
        --collect-all cffi \
        --collect-all cryptography \
        --collect-all PyJWT \
        credential_provider/__main__.py
    
    # The binary will be in /output/{binary_name}
    
    
  • https://github.com/aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?