canonical / charmcraft

Collaborate, build and publish charmed operators for Kubernetes, Linux and Windows.
Apache License 2.0
65 stars 69 forks source link

PYDEPS overrides pinned dependencies in requirements.txt #1135

Closed carlcsaposs-canonical closed 1 day ago

carlcsaposs-canonical commented 1 year ago

Bug Description

Example: pgbouncer-operator has pydantic==1.10.9 in its requirements.txt pgbouncer-operator also uses a charm lib with PYDEPS = ["cosl", "pydantic"]

During charmcraft pack, the unpinned pydantic charm lib dependency overrides the pinned pydantic dependency and installs pydantic version 2

To Reproduce

git clone https://github.com/canonical/pgbouncer-operator
cd pgbouncer-operator
charmcraft pack

Environment

Ubuntu 22.04 LTS

charmcraft.yaml

# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.

type: charm
bases:
  - build-on:
      - name: "ubuntu"
        channel: "20.04"
    run-on:
      - name: "ubuntu"
        channel: "20.04"
  - build-on:
      - name: "ubuntu"
        channel: "22.04"
    run-on:
      - name: "ubuntu"
        channel: "22.04"

parts:
  charm:
    charm-binary-python-packages:
      - psycopg2-binary==2.9.6  # renovate
      - psycopg[binary]==3.1.9  # renovate

Relevant log output

2023-07-03 01:24:02.790 Starting charmcraft version 2.3.0
2023-07-03 01:24:02.795 System details: OSPlatform(system='ubuntu', release='22.04', machine='x86_64'); Environment: None
2023-07-03 01:24:02.795 Packing the charm.
2023-07-03 01:24:02.795 Reading '/home/runner/work/pgbouncer-operator/pgbouncer-operator/metadata.yaml'
2023-07-03 01:24:02.801 Validating metadata format
2023-07-03 01:24:02.952 Executing on host: lxc --project default profile show local:default
2023-07-03 01:24:03.017 Building for 'bases[0]' as host matches 'build-on[0]'.
2023-07-03 01:24:03.017 Skipping 'bases[1]' due to --base-index usage.
2023-07-03 01:24:03.017 Building for 'bases[0][0]'.
2023-07-03 01:24:03.017 Launching environment to pack for base name='ubuntu' channel='20.04' architectures=['amd64'] (may take a while the first time but it's reusable)
2023-07-03 01:24:03.019 Using hostname 'charmcraft-pgbouncer-1113618-0-0-amd64'
2023-07-03 01:24:03.019 Executing on host: lxc remote list --format=yaml
2023-07-03 01:24:03.078 Executing on host: lxc remote add craft-com.ubuntu.cloud-buildd https://cloud-images.ubuntu.com/buildd/releases --protocol=simplestreams
2023-07-03 01:24:03.137 Remote 'craft-com.ubuntu.cloud-buildd' was successfully added.
2023-07-03 01:24:03.138 Executing on host: lxc project list local: --format=yaml
2023-07-03 01:24:03.203 Set LXD instance name to 'charmcraft-pgbouncer-1113618-0-0-amd64'
2023-07-03 01:24:03.204 Checking for instance 'charmcraft-pgbouncer-1113618-0-0-amd64' in project 'charmcraft' in remote 'local'
2023-07-03 01:24:03.204 Executing on host: lxc --project charmcraft list local: --format=yaml
2023-07-03 01:24:03.296 Executing on host: lxc --project charmcraft config get local:charmcraft-pgbouncer-1113618-0-0-amd64 raw.idmap
2023-07-03 01:24:03.362 Executing on host: lxc --project charmcraft list local: --format=yaml
2023-07-03 01:24:03.444 Instance exists and is not running. Starting instance.
2023-07-03 01:24:03.444 Executing on host: lxc --project charmcraft start local:charmcraft-pgbouncer-1113618-0-0-amd64
2023-07-03 01:24:04.039 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 test -f /etc/craft-instance.conf
2023-07-03 01:24:04.152 Executing on host: lxc --project charmcraft file pull local:charmcraft-pgbouncer-1113618-0-0-amd64/etc/craft-instance.conf /home/runner/tmpk3fjx09i.tmp-craft/tmpg7_fmr8f
2023-07-03 01:24:04.305 Instance has already been setup.
2023-07-03 01:24:04.305 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 cat /etc/os-release
2023-07-03 01:24:04.453 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 test -f /etc/craft-instance.conf
2023-07-03 01:24:04.608 Executing on host: lxc --project charmcraft file pull local:charmcraft-pgbouncer-1113618-0-0-amd64/etc/craft-instance.conf /home/runner/tmpe9kyzh6a.tmp-craft/tmp1ivdvm9t
2023-07-03 01:24:04.716 Instance is compatible with compatibility tag 'charmcraft-buildd-base-v1.0'
2023-07-03 01:24:04.716 Waiting for environment to be ready...
2023-07-03 01:24:04.717 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 systemctl is-system-running
2023-07-03 01:24:04.883 systemctl is-system-running status: starting
2023-07-03 01:24:05.134 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 systemctl is-system-running
2023-07-03 01:24:05.297 systemctl is-system-running status: starting
2023-07-03 01:24:05.548 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 systemctl is-system-running
2023-07-03 01:24:05.696 systemctl is-system-running status: starting
2023-07-03 01:24:05.947 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 systemctl is-system-running
2023-07-03 01:24:06.103 systemctl is-system-running status: starting
2023-07-03 01:24:06.354 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 systemctl is-system-running
2023-07-03 01:24:06.517 systemctl is-system-running status: starting
2023-07-03 01:24:06.768 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 systemctl is-system-running
2023-07-03 01:24:06.903 systemctl is-system-running status: starting
2023-07-03 01:24:07.154 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 systemctl is-system-running
2023-07-03 01:24:07.302 systemctl is-system-running status: starting
2023-07-03 01:24:07.552 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 systemctl is-system-running
2023-07-03 01:24:07.714 systemctl is-system-running status: starting
2023-07-03 01:24:07.965 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 systemctl is-system-running
2023-07-03 01:24:08.127 systemctl is-system-running status: starting
2023-07-03 01:24:08.377 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 systemctl is-system-running
2023-07-03 01:24:08.483 Waiting for networking to be ready...
2023-07-03 01:24:08.483 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 getent hosts snapcraft.io
2023-07-03 01:24:08.643 Holding refreshes for snaps.
2023-07-03 01:24:08.643 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 snap set system refresh.hold=2023-07-04T01:24:08.643067Z
2023-07-03 01:24:10.187 Waiting for pending snap refreshes to complete.
2023-07-03 01:24:10.188 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 snap watch '--last=auto-refresh?'
2023-07-03 01:24:10.348 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 snap unset system proxy.http
2023-07-03 01:24:10.590 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 snap unset system proxy.https
2023-07-03 01:24:10.821 Installing snap 'charmcraft' with channel=None and classic=True
2023-07-03 01:24:10.821 Installing snap 'charmcraft' from host (classic=True)
2023-07-03 01:24:10.829 Executing in container: lxc --project charmcraft exec local:charmcraft-pgbouncer-1113618-0-0-amd64 -- env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin CHARMCRAFT_MANAGED_MODE=1 test -f /etc/craft-instance.conf
2023-07-03 01:24:10.927 Executing on host: lxc --project charmcraft file pull local:charmcraft-pgbouncer-1113618-0-0-amd64/etc/craft-instance.conf /home/runner/tmp6hw0o6ai.tmp-craft/tmpzx1mixgm
2023-07-03 01:24:11.000 Revisions found: host='1349', target='1349'
2023-07-03 01:24:11.000 Skipping snap injection: target is already up-to-date with revision on host
2023-07-03 01:24:11.000 Mounting directory inside the instance
2023-07-03 01:24:11.000 Executing on host: lxc --project charmcraft config device show local:charmcraft-pgbouncer-1113618-0-0-amd64
2023-07-03 01:24:11.069 Executing on host: lxc --project charmcraft config device add local:charmcraft-pgbouncer-1113618-0-0-amd64 disk-/root/project disk source=/home/runner/work/pgbouncer-operator/pgbouncer-operator path=/root/project
2023-07-03 01:24:11.163 Packing the charm
2023-07-03 01:24:11.164 Running ['charmcraft', 'pack', '--bases-index', '0', '--verbosity=brief']
2023-07-03 01:24:11.164 Emitter: Pausing control of the terminal
2023-07-03 01:31:32.622 Emitter: Resuming control of the terminal
2023-07-03 01:31:32.835 Logs captured from managed instance:
2023-07-03 01:31:32.835 :: 2023-07-03 01:24:14.611 Starting charmcraft version 2.3.0
2023-07-03 01:31:32.835 :: 2023-07-03 01:24:14.617 System details: OSPlatform(system='ubuntu', release='20.04', machine='x86_64'); Environment: CHARMCRAFT_MANAGED_MODE='1'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.617 Packing the charm.
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.617 Reading '/root/project/metadata.yaml'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.623 Validating metadata format
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.634 Building for 'bases[0]' as host matches 'build-on[0]'.
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.634 Skipping 'bases[1]' due to --base-index usage.
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.634 Building for 'bases[0][0]'.
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.634 Building charm in '/root'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.676 Parts definition: {'charm': {'source': '/root/project', 'charm-entrypoint': 'src/charm.py', 'charm-binary-python-packages': ['psycopg2-binary==2.9.6', 'psycopg[binary]==3.1.9'], 'charm-python-packages': [], 'charm-requirements': ['requirements.txt'], 'plugin': 'charm', 'prime': ['src', 'venv', 'metadata.yaml', 'dispatch', 'hooks', 'config.yaml', 'templates', 'lib', 'LICENSE', 'icon.svg', 'README.md']}}
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.676 is_snap: True, SNAP_NAME set to charmcraft
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.677 Setting target machine to x86_64
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.678 load state file: /root/parts/charm/state/pull
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.684 load state file: /root/parts/charm/state/build
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.704 load state file: /root/parts/charm/state/stage
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.823 load state file: /root/parts/charm/state/prime
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.938 Executing parts lifecycle in '/root/project'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.938 process charm:Step.PULL
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.938 check if Part('charm'):Step.PULL is dirty
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.938 check if Part('charm'):Step.PULL is outdated
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.938 ignore patterns: ['*.charm']
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.939 updated files: {'icon.svg', 'renovate.json', 'charmcraft.yaml', 'pyproject.toml', 'config.yaml', 'poetry.lock', 'tox.ini', 'CONTRIBUTING.md', 'LICENSE', 'requirements.txt', '.gitignore', 'metadata.yaml', 'README.md'}
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.939 updated directories: {'templates', 'src', '.github', 'lib', '.git', 'tests'}
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.939 charm:Step.PULL is outdated
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.939 update step charm:Step.PULL
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.939 add action charm:Step.PULL(ActionType.UPDATE)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.940 process charm:Step.BUILD
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.940 check if Part('charm'):Step.BUILD is dirty
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.954 check if Part('charm'):Step.BUILD is outdated
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.954 charm:Step.BUILD is outdated
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.954 update step charm:Step.BUILD
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.954 add action charm:Step.BUILD(ActionType.UPDATE)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.954 process charm:Step.STAGE
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.954 check if Part('charm'):Step.STAGE is dirty
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.954 check if Part('charm'):Step.STAGE is outdated
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.954 charm:Step.STAGE is outdated
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.954 rerun step charm:Step.STAGE
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.954 add action charm:Step.STAGE(ActionType.RERUN)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.955 process charm:Step.PRIME
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.955 add action charm:Step.PRIME(ActionType.RUN)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.955 Parts actions: [Action(part_name='charm', step=Step.PULL, action_type=ActionType.UPDATE, reason='source changed', project_vars=None, properties=ActionProperties(changed_files=['.gitignore', 'CONTRIBUTING.md', 'LICENSE', 'README.md', 'charmcraft.yaml', 'config.yaml', 'icon.svg', 'metadata.yaml', 'poetry.lock', 'pyproject.toml', 'renovate.json', 'requirements.txt', 'tox.ini'], changed_dirs=['.git', '.github', 'lib', 'src', 'templates', 'tests'])), Action(part_name='charm', step=Step.BUILD, action_type=ActionType.UPDATE, reason="'PULL' step changed", project_vars=None, properties=ActionProperties(changed_files=['.gitignore', 'CONTRIBUTING.md', 'LICENSE', 'README.md', 'charmcraft.yaml', 'config.yaml', 'icon.svg', 'metadata.yaml', 'poetry.lock', 'pyproject.toml', 'renovate.json', 'requirements.txt', 'tox.ini'], changed_dirs=['.git', '.github', 'lib', 'src', 'templates', 'tests'])), Action(part_name='charm', step=Step.STAGE, action_type=ActionType.RERUN, reason="'BUILD' step changed", project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None)), Action(part_name='charm', step=Step.PRIME, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))]
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.955 ignore patterns: ['*.charm']
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.956 plugin build packages: {'python3-dev', 'python3-pip', 'python3-wheel', 'python3-setuptools', 'python3-venv'}
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:14.956 Requested build-packages: ['python3-dev', 'python3-pip', 'python3-setuptools', 'python3-venv', 'python3-wheel']
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.552 Marking python3-dev (and its dependencies) to be fetched
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.553 package: python3-dev
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.563 Marking python3-pip (and its dependencies) to be fetched
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.563 package: python3-pip
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.569 Marking python3-wheel (and its dependencies) to be fetched
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.569 package: python3-wheel
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.575 Marking python3-setuptools (and its dependencies) to be fetched
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.575 package: python3-setuptools
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.581 Marking python3-venv (and its dependencies) to be fetched
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.581 package: python3-venv
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.610 Requested build-packages already installed: ['python3-dev', 'python3-pip', 'python3-setuptools', 'python3-venv', 'python3-wheel']
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.906 verify plugin environment for part 'charm'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.907 Running step PULL for part 'charm'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.907 Execute action
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.908 execute action charm:Action(part_name='charm', step=Step.PULL, action_type=ActionType.UPDATE, reason='source changed', project_vars=None, properties=ActionProperties(changed_files=['.gitignore', 'CONTRIBUTING.md', 'LICENSE', 'README.md', 'charmcraft.yaml', 'config.yaml', 'icon.svg', 'metadata.yaml', 'poetry.lock', 'pyproject.toml', 'renovate.json', 'requirements.txt', 'tox.ini'], changed_dirs=['.git', '.github', 'lib', 'src', 'templates', 'tests']))
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.909 updated files: {'icon.svg', 'renovate.json', 'charmcraft.yaml', 'pyproject.toml', 'config.yaml', 'poetry.lock', 'tox.ini', 'CONTRIBUTING.md', 'LICENSE', 'requirements.txt', '.gitignore', 'metadata.yaml', 'README.md'}
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.909 updated directories: {'templates', 'src', '.github', 'lib', '.git', 'tests'}
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.974 load state file: /root/parts/charm/state/pull
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.986 Running step BUILD for part 'charm'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.986 Execute action
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.986 execute action charm:Action(part_name='charm', step=Step.BUILD, action_type=ActionType.UPDATE, reason="'PULL' step changed", project_vars=None, properties=ActionProperties(changed_files=['.gitignore', 'CONTRIBUTING.md', 'LICENSE', 'README.md', 'charmcraft.yaml', 'config.yaml', 'icon.svg', 'metadata.yaml', 'poetry.lock', 'pyproject.toml', 'renovate.json', 'requirements.txt', 'tox.ini'], changed_dirs=['.git', '.github', 'lib', 'src', 'templates', 'tests']))
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.987 ignore patterns: []
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.987 updated files: {'icon.svg', 'renovate.json', 'charmcraft.yaml', 'pyproject.toml', 'config.yaml', 'poetry.lock', 'tox.ini', 'CONTRIBUTING.md', 'LICENSE', 'requirements.txt', '.gitignore', 'metadata.yaml', 'README.md'}
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:15.987 updated directories: {'templates', 'src', '.github', 'lib', '.git', 'tests'}
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:16.027 remove directory /root/parts/charm/install
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:16.041 load state file: /root/parts/charm/state/pull
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:16.049 Executing PosixPath('/root/parts/charm/run/build.sh')
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:16.054 :: + env -i LANG=C.UTF-8 LC_ALL=C.UTF-8 PATH=/snap/charmcraft/1349/libexec/charmcraft:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin SNAP=/snap/charmcraft/1349 SNAP_ARCH=amd64 SNAP_NAME=charmcraft SNAP_VERSION=2.3.0 /snap/charmcraft/1349/bin/python3 -u -I /snap/charmcraft/1349/lib/charmcraft/charm_builder.py --builddir /root/parts/charm/build --installdir /root/parts/charm/install --entrypoint /root/parts/charm/build/src/charm.py -b psycopg2-binary==2.9.6 -b 'psycopg[binary]==3.1.9' -r requirements.txt
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.014 :: Starting charm builder
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.014 :: Translated .jujuignore 2 '.git' => '.*/\\.git\\Z'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.014 :: Translated .jujuignore 3 '.svn' => '.*/\\.svn\\Z'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.014 :: Translated .jujuignore 4 '.hg' => '.*/\\.hg\\Z'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.014 :: Translated .jujuignore 5 '.bzr' => '.*/\\.bzr\\Z'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.014 :: Translated .jujuignore 6 '.tox' => '.*/\\.tox\\Z'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.015 :: Translated .jujuignore 8 '/build/' => '/build\\Z'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.015 :: Translated .jujuignore 9 '/revision' => '/revision\\Z'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.015 :: Translated .jujuignore 10 '/venv' => '/venv\\Z'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.015 :: Translated .jujuignore 12 '.jujuignore' => '.*/\\.jujuignore\\Z'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.015 :: Translated .jujuignore 1 '/staging-venv' => '/staging\\-venv\\Z'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.051 :: Collected charmlib dependencies: {'ops>=2.0.0', 'pydantic', 'cosl'}
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.051 :: Building charm in '/root/parts/charm/install'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.051 :: Linking in generic paths
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.052 :: Ignoring directory because of rules: '.git'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.052 :: Ignoring directory because of rules: 'staging-venv'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.057 :: Creating the dispatch mechanism
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.057 :: Creating the 'install' hook script pointing to dispatch
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.057 :: Creating the 'upgrade-charm' hook script pointing to dispatch
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.057 :: Creating the 'start' hook script pointing to dispatch
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.057 :: Handling dependencies
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.058 :: Current dependencies hash: '5f442870c401866f90132479c18d19430a0b5d7c'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.058 :: Previous dependencies hash: 'fc23dbfc2ec5c7f5987e7e8e3e1f5f85f0f4c3aa'
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.058 :: Installing dependencies
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:17.058 :: Running external command ['python3', '-m', 'venv', '/root/parts/charm/build/staging-venv']
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:18.335 :: Running external command ['/root/parts/charm/build/staging-venv/bin/pip3', '--version']
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:19.066 ::    :: pip 20.0.2 from /root/parts/charm/build/staging-venv/lib/python3.8/site-packages/pip (python 3.8)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:19.094 :: Running external command ['/root/parts/charm/build/staging-venv/bin/pip3', 'install', '--upgrade', 'psycopg2-binary==2.9.6', 'psycopg[binary]==3.1.9']
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:20.289 ::    :: Requirement already up-to-date: psycopg2-binary==2.9.6 in ./staging-venv/lib/python3.8/site-packages (2.9.6)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:20.372 ::    :: Requirement already up-to-date: psycopg[binary]==3.1.9 in ./staging-venv/lib/python3.8/site-packages (3.1.9)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:20.392 ::    :: Requirement already satisfied, skipping upgrade: backports.zoneinfo>=0.2.0; python_version < "3.9" in ./staging-venv/lib/python3.8/site-packages (from psycopg[binary]==3.1.9) (0.2.1)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:20.395 ::    :: Requirement already satisfied, skipping upgrade: typing-extensions>=4.1 in ./staging-venv/lib/python3.8/site-packages (from psycopg[binary]==3.1.9) (4.6.3)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:20.397 ::    :: Requirement already satisfied, skipping upgrade: psycopg-binary==3.1.9; extra == "binary" in ./staging-venv/lib/python3.8/site-packages (from psycopg[binary]==3.1.9) (3.1.9)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:20.460 :: Running external command ['/root/parts/charm/build/staging-venv/bin/pip3', 'install', '--upgrade', '--no-binary', ':all:', '--requirement=requirements.txt']
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:21.836 ::    :: Requirement already up-to-date: cosl==0.0.5 in ./staging-venv/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (0.0.5)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:21.893 ::    :: Requirement already up-to-date: ops==2.3.0 in ./staging-venv/lib/python3.8/site-packages (from -r requirements.txt (line 4)) (2.3.0)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:21.965 ::    :: Requirement already up-to-date: pgconnstr==1.0.1 in ./staging-venv/lib/python3.8/site-packages (from -r requirements.txt (line 7)) (1.0.1)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:22.276 ::    :: Requirement already up-to-date: pydantic==1.10.9 in ./staging-venv/lib/python3.8/site-packages (from -r requirements.txt (line 10)) (1.10.9)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:22.368 ::    :: Requirement already up-to-date: pyyaml==6.0 in ./staging-venv/lib/python3.8/site-packages (from -r requirements.txt (line 47)) (6.0)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:22.431 ::    :: Requirement already up-to-date: tenacity==8.2.2 in ./staging-venv/lib/python3.8/site-packages (from -r requirements.txt (line 88)) (8.2.2)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:22.467 ::    :: Requirement already up-to-date: typing-extensions==4.6.3 in ./staging-venv/lib/python3.8/site-packages (from -r requirements.txt (line 91)) (4.6.3)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:22.524 ::    :: Requirement already up-to-date: websocket-client==1.6.1 in ./staging-venv/lib/python3.8/site-packages (from -r requirements.txt (line 94)) (1.6.1)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:22.603 :: Running external command ['/root/parts/charm/build/staging-venv/bin/pip3', 'install', '--upgrade', '--no-binary', ':all:', 'ops>=2.0.0', 'pydantic', 'cosl']
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:23.710 ::    :: Requirement already up-to-date: ops>=2.0.0 in ./staging-venv/lib/python3.8/site-packages (2.3.0)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:24.268 ::    :: Collecting pydantic
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:24.364 ::    ::   Downloading pydantic-2.0.tar.gz (572 kB)
2023-07-03 01:31:32.836 :: 2023-07-03 01:24:24.495 ::    ::   Installing build dependencies: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:25:26.642 ::    ::   Installing build dependencies: still running...
2023-07-03 01:31:32.836 :: 2023-07-03 01:26:35.109 ::    ::   Installing build dependencies: still running...
2023-07-03 01:31:32.836 :: 2023-07-03 01:27:36.516 ::    ::   Installing build dependencies: still running...
2023-07-03 01:31:32.836 :: 2023-07-03 01:28:43.463 ::    ::   Installing build dependencies: still running...
2023-07-03 01:31:32.836 :: 2023-07-03 01:28:48.355 ::    ::   Installing build dependencies: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:28:48.357 ::    ::   Getting requirements to build wheel: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:28:48.425 ::    ::   Getting requirements to build wheel: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:28:48.427 ::    ::     Preparing wheel metadata: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:28:48.552 ::    ::     Preparing wheel metadata: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:28:48.603 ::    :: Requirement already up-to-date: cosl in ./staging-venv/lib/python3.8/site-packages (0.0.5)
2023-07-03 01:31:32.836 :: 2023-07-03 01:28:48.605 ::    :: Requirement already satisfied, skipping upgrade: PyYAML==6.* in ./staging-venv/lib/python3.8/site-packages (from ops>=2.0.0) (6.0)
2023-07-03 01:31:32.836 :: 2023-07-03 01:28:48.607 ::    :: Requirement already satisfied, skipping upgrade: websocket-client==1.* in ./staging-venv/lib/python3.8/site-packages (from ops>=2.0.0) (1.6.1)
2023-07-03 01:31:32.836 :: 2023-07-03 01:28:48.642 ::    :: Collecting annotated-types>=0.4.0
2023-07-03 01:31:32.836 :: 2023-07-03 01:28:48.668 ::    ::   Downloading annotated_types-0.5.0.tar.gz (13 kB)
2023-07-03 01:31:32.836 :: 2023-07-03 01:28:48.678 ::    ::   Installing build dependencies: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:29:51.619 ::    ::   Installing build dependencies: still running...
2023-07-03 01:31:32.836 :: 2023-07-03 01:30:57.886 ::    ::   Installing build dependencies: still running...
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:02.673 ::    ::   Installing build dependencies: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:02.674 ::    ::   Getting requirements to build wheel: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:02.744 ::    ::   Getting requirements to build wheel: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:02.745 ::    ::     Preparing wheel metadata: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:02.855 ::    ::     Preparing wheel metadata: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:02.866 ::    :: Requirement already satisfied, skipping upgrade: typing-extensions>=4.6.1 in ./staging-venv/lib/python3.8/site-packages (from pydantic) (4.6.3)
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:03.797 ::    :: Collecting pydantic-core==2.0.1
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:03.838 ::    ::   Downloading pydantic_core-2.0.1.tar.gz (305 kB)
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:03.898 ::    ::   Installing build dependencies: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.297 ::    ::   Installing build dependencies: finished with status 'error'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::   ERROR: Command errored out with exit status 1:
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::    command: /root/parts/charm/build/staging-venv/bin/python3 /root/parts/charm/build/staging-venv/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-dnic1hmb/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- 'maturin>=1,<2' 'typing-extensions >=4.6.0; platform_python_implementation != "PyPy"' 'typing-extensions >=4.6.0,<4.7.0; platform_python_implementation == "PyPy"'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::        cwd: None
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::   Complete output (78 lines):
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::   Ignoring typing-extensions: markers 'platform_python_implementation == "PyPy"' don't match your environment
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::   Collecting maturin<2,>=1
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Downloading maturin-1.1.0.tar.gz (181 kB)
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Installing build dependencies: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Installing build dependencies: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Getting requirements to build wheel: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Getting requirements to build wheel: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::       Preparing wheel metadata: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::       Preparing wheel metadata: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::   Collecting typing-extensions>=4.6.0
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Using cached typing_extensions-4.7.1.tar.gz (72 kB)
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Installing build dependencies: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Installing build dependencies: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Getting requirements to build wheel: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Getting requirements to build wheel: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::       Preparing wheel metadata: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::       Preparing wheel metadata: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::   Collecting tomli>=1.1.0; python_version < "3.11"
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Using cached tomli-2.0.1.tar.gz (15 kB)
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Installing build dependencies: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Installing build dependencies: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Getting requirements to build wheel: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Getting requirements to build wheel: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::       Preparing wheel metadata: started
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::       Preparing wheel metadata: finished with status 'done'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::   Building wheels for collected packages: maturin, typing-extensions, tomli
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Building wheel for maturin (PEP 517): started
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Building wheel for maturin (PEP 517): finished with status 'error'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     ERROR: Command errored out with exit status 1:
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::      command: /root/parts/charm/build/staging-venv/bin/python3 /tmp/tmps2tqqmjj build_wheel /tmp/tmp6sd9rga0
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::          cwd: /tmp/pip-install-zcme2ad8/maturin
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     Complete output (33 lines):
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     running bdist_wheel
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     running build
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     running build_py
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     creating build
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     creating build/lib.linux-x86_64-cpython-38
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     creating build/lib.linux-x86_64-cpython-38/maturin
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     copying maturin/__init__.py -> build/lib.linux-x86_64-cpython-38/maturin
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     copying maturin/import_hook.py -> build/lib.linux-x86_64-cpython-38/maturin
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     copying maturin/__main__.py -> build/lib.linux-x86_64-cpython-38/maturin
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     running egg_info
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     creating maturin.egg-info
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     writing maturin.egg-info/PKG-INFO
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     writing dependency_links to maturin.egg-info/dependency_links.txt
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     writing requirements to maturin.egg-info/requires.txt
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     writing top-level names to maturin.egg-info/top_level.txt
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     writing manifest file 'maturin.egg-info/SOURCES.txt'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     reading manifest file 'maturin.egg-info/SOURCES.txt'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     reading manifest template 'MANIFEST.in'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     warning: no files found matching '*.json' under directory 'src/python_interpreter'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     writing manifest file 'maturin.egg-info/SOURCES.txt'
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     running build_ext
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     running build_rust
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     error: can't find Rust compiler
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::     If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
2023-07-03 01:31:32.836 :: 2023-07-03 01:31:32.298 ::    ::
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::     To update pip, run:
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::         pip install --upgrade pip
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::     and then retry package installation.
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::     If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::     ----------------------------------------
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::     ERROR: Failed building wheel for maturin
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::     Building wheel for typing-extensions (PEP 517): started
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::     Building wheel for typing-extensions (PEP 517): finished with status 'done'
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::     Created wheel for typing-extensions: filename=typing_extensions-4.7.1-py3-none-any.whl size=33232 sha256=cabd4dcc82c306fe7dc7f141b7b8b83999c16f80701079e8a2431d05070580b9
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::     Stored in directory: /root/.cache/pip/wheels/57/fa/42/6a380ab18de3f5537dae2ef72836ffbce5b24453ee3e772324
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::     Building wheel for tomli (PEP 517): started
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::     Building wheel for tomli (PEP 517): finished with status 'done'
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::     Created wheel for tomli: filename=tomli-2.0.1-py3-none-any.whl size=12758 sha256=b57d53172b3432857125ceaa4b9b2d28e4ae0510c95c5cf031955ada144ba3ff
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::     Stored in directory: /root/.cache/pip/wheels/bb/b6/90/165ed2d4e3933c7567df3ca84de8db1cf47278a1673e8c476c
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::   Successfully built typing-extensions tomli
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::   Failed to build maturin
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::   ERROR: Could not build wheels for maturin which use PEP 517 and cannot be installed directly
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.298 ::    ::   ----------------------------------------
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.327 ::    :: ERROR: Command errored out with exit status 1: /root/parts/charm/build/staging-venv/bin/python3 /root/parts/charm/build/staging-venv/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-dnic1hmb/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- 'maturin>=1,<2' 'typing-extensions >=4.6.0; platform_python_implementation != "PyPy"' 'typing-extensions >=4.6.0,<4.7.0; platform_python_implementation == "PyPy"' Check the logs for full command output.
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.416 :: Traceback (most recent call last):
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.416 ::   File "/snap/charmcraft/1349/lib/charmcraft/charm_builder.py", line 435, in <module>
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.417 ::     main()
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.417 ::   File "/snap/charmcraft/1349/lib/charmcraft/charm_builder.py", line 430, in main
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.417 ::     builder.build_charm()
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.417 ::   File "/snap/charmcraft/1349/lib/charmcraft/charm_builder.py", line 103, in build_charm
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.417 ::     self.handle_dependencies()
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.417 ::   File "/snap/charmcraft/1349/lib/charmcraft/charm_builder.py", line 317, in handle_dependencies
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.417 ::     self._install_dependencies(staging_venv_dir)
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.417 ::   File "/snap/charmcraft/1349/lib/charmcraft/instrum.py", line 152, in _f
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.417 ::     return func(*args, **kwargs)
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.417 ::   File "/snap/charmcraft/1349/lib/charmcraft/charm_builder.py", line 277, in _install_dependencies
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.418 ::     _process_run(cmd)
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.418 ::   File "/snap/charmcraft/1349/lib/charmcraft/charm_builder.py", line 371, in _process_run
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.422 ::     raise RuntimeError(f"Subprocess command {cmd} execution failed with retcode {retcode}")
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.422 :: RuntimeError: Subprocess command ['/root/parts/charm/build/staging-venv/bin/pip3', 'install', '--upgrade', '--no-binary', ':all:', 'ops>=2.0.0', 'pydantic', 'cosl'] execution failed with retcode 1
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.539 Parts processing error: Failed to run the build script for part 'charm'.
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544 Traceback (most recent call last):
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/lib/craft_parts/executor/step_handler.py", line 146, in _builtin_build
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     _create_and_run_script(
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/lib/craft_parts/executor/step_handler.py", line 409, in _create_and_run_script
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     subprocess.run(
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/usr/lib/python3.8/subprocess.py", line 516, in run
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     raise CalledProcessError(retcode, process.args,
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544 subprocess.CalledProcessError: Command '[PosixPath('/root/parts/charm/run/build.sh')]' returned non-zero exit status 1.
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544 The above exception was the direct cause of the following exception:
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544 Traceback (most recent call last):
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/lib/charmcraft/parts.py", line 468, in run
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     aex.execute([act], stdout=stream, stderr=stream)
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/lib/craft_parts/executor/executor.py", line 304, in execute
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     self._executor.execute(actions, stdout=stdout, stderr=stderr)
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/lib/craft_parts/executor/executor.py", line 128, in execute
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     self._run_action(act, stdout=stdout, stderr=stderr)
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/lib/craft_parts/executor/executor.py", line 193, in _run_action
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     handler.run_action(action, stdout=stdout, stderr=stderr)
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/lib/craft_parts/executor/part_handler.py", line 137, in run_action
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     self._update_action(
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/lib/craft_parts/executor/part_handler.py", line 546, in _update_action
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     handler(step_info, stdout=stdout, stderr=stderr)
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/lib/craft_parts/executor/part_handler.py", line 642, in _update_build
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     self._run_build(step_info, stdout=stdout, stderr=stderr, update=True)
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/lib/craft_parts/executor/part_handler.py", line 309, in _run_build
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     self._run_step(
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/lib/craft_parts/executor/part_handler.py", line 493, in _run_step
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     return step_handler.run_builtin()
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/lib/craft_parts/executor/step_handler.py", line 106, in run_builtin
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     return handler()
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544   File "/snap/charmcraft/1349/lib/craft_parts/executor/step_handler.py", line 155, in _builtin_build
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544     raise errors.PluginBuildError(part_name=self._part.name) from process_error
2023-07-03 01:31:32.837 :: 2023-07-03 01:31:32.544 craft_parts.errors.PluginBuildError: Failed to run the build script for part 'charm'.
2023-07-03 01:31:34.198 Failed to build charm for bases index '0'.
2023-07-03 01:31:34.202 Traceback (most recent call last):
2023-07-03 01:31:34.202   File "/snap/charmcraft/1349/lib/charmcraft/commands/build.py", line 388, in pack_charm_in_instance
2023-07-03 01:31:34.202     instance.execute_run(cmd, check=True, cwd=instance_output_dir)
2023-07-03 01:31:34.202   File "/snap/charmcraft/1349/lib/craft_providers/lxd/lxd_instance.py", line 289, in execute_run
2023-07-03 01:31:34.202     return self.lxc.exec(
2023-07-03 01:31:34.202   File "/snap/charmcraft/1349/lib/craft_providers/lxd/lxc.py", line 371, in exec
2023-07-03 01:31:34.202     return runner(final_cmd, **kwargs)  # pylint: disable=subprocess-run-check
2023-07-03 01:31:34.202   File "/snap/charmcraft/1349/usr/lib/python3.8/subprocess.py", line 516, in run
2023-07-03 01:31:34.202     raise CalledProcessError(retcode, process.args,
2023-07-03 01:31:34.202 subprocess.CalledProcessError: Command '['lxc', '--project', 'charmcraft', 'exec', 'local:charmcraft-pgbouncer-1113618-0-0-amd64', '--cwd', '/root/project', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'CHARMCRAFT_MANAGED_MODE=1', 'charmcraft', 'pack', '--bases-index', '0', '--verbosity=brief']' returned non-zero exit status 1.
2023-07-03 01:31:34.202 Full execution log: '/home/runner/.local/state/charmcraft/log/charmcraft-20230703-012402.789886.log'
sed-i commented 1 year ago

I imagine this is by design: Lib authors should avoid pinning in PYDEPS if possible. If they do pin, it should be for a good reason. By having PYDEPS at a higher priority, we're more likely to have things fail earlier, which is a good thing.

carlcsaposs-canonical commented 1 year ago

I imagine this is by design: Lib authors should avoid pinning in PYDEPS if possible. If they do pin, it should be for a good reason. By having PYDEPS at a higher priority, we're more likely to have things fail earlier, which is a good thing.

The problem is that unpinned PYDEPS will override pinned deps in requirements.txt

lengau commented 1 year ago

I realised my thoughts about this have been scattered, so I'm writing this comment just to put everything into a coherent bundle.

The current process works as follows:

  1. Install binary packages with --upgrade
  2. Install non-binary packages with --upgrade
  3. Install requirements files with --upgrade
  4. Install charmlib deps with --upgrade (<-- our antagonist)

In the general case, this might be worth reconsidering as a whole (see #1140). But in the more specific case of this bug, we probably just need to ensure that charmlib deps don't override requirements.txt.

The best way to do this is probably to combine steps 3 and 4 into a single pip command. Step 2 can probably come along with that essentially for free, but step 1 will need its own thoughts.

lengau commented 12 months ago

Closing to be merged into #1135

carlcsaposs-canonical commented 11 months ago

Closing to be merged into #1135

@lengau which issue/pr was this merged into? #1135 is this issue

DnPlas commented 2 months ago

Hi @lengau, I understand that this issue should've been resolved by #1157, but I am still running into it. Interestingly enough, there are a number of inconsistencies with how the packages get installed and how their versions get overridden. Here are my findings:

Test environment

  1. Charmcraft version 2.7.0
  2. Create a new charm from scratch with charmcraft init.
  3. The requirements.txt only pins ops ~= 2.5
  4. This is the charmcraft.yaml
name: my-charm
type: charm
title: Charm Template
summary: A very short one-line summary of the charm.
description: |
  A single sentence that says what the charm is, concisely and memorably.

  A paragraph of one to three short sentences, that describe what the charm does.

  A third paragraph that explains what need the charm meets.

  Finally, a paragraph that describes whom the charm is useful for.
bases:
  - build-on:
    - name: ubuntu
      channel: "20.04" <-- please NOTE I have used this and newer versions like 22.04
    run-on:
    - name: ubuntu
      channel: "20.04"
containers:
  httpbin:
    resource: httpbin-image
resources:
  httpbin-image:
    type: oci-image
    description: OCI image for httpbin
    upstream-source: kennethreitz/httpbin

Case 1 - does not fail

Take the charm from before and do the following:

  1. Add a library that adds PYDEPS, e.g. charmcraft fetch-lib charms.prometheus_k8s.v0.prometheus_scrape
  2. Pin cosl==0.0.12 in requirements.txt:
cosl==0.0.12
ops ~= 2.5
  1. Observe the results - in this case, the install of cosl was as expected:
::    :: Successfully installed cosl-0.0.12 ops-2.15.0 pyyaml-6.0.1 typing-extensions-4.12.2 websocket-client-1.8.0 wheel-0.43.0                                             

Full execution log

Case 2 - fails

  1. Keep the same library from before
  2. Add more packages to requirements.txt - wget https://raw.githubusercontent.com/canonical/knative-operators/track/1.12/charms/knative-operator/requirements.txt
  3. Clean and pack again
$ charmcraft clean
Cleaning project 'my-charm'.                                                                                                                                                 
Cleaned project 'my-charm'.                                                                                                                                                  
$ charmcraft pack -v
  1. Observe that cosl gets installed with the expected version, but then upgraded at some point during the build and the pin gets ignored. Expected is 0.0.12.
::    :: Installing collected packages: lightkube-models, zipp, websocket-client, urllib3, typing-extensions, tenacity, sniffio, ruamel-yaml-clib, pyyaml, pyrsistent, pkgutil-resolve-name, ordered-set, markupsafe, idna, h11, exceptiongroup, charset-normalizer, certifi, attrs, ruamel-yaml, requests, ops, jinja2, importlib-resources, deepdiff, anyio, jsonschema, httpcore, cosl, serialized-data-interface, httpx, lightkube, charmed-kubeflow-chisme                                                                          
::    :: Successfully installed anyio-4.0.0 attrs-23.1.0 certifi-2023.7.22 charmed-kubeflow-chisme-0.2.0 charset-normalizer-3.2.0 cosl-0.0.12 deepdiff-6.2.1 exceptiongroup-1.1.3 h11-0.14.0 httpcore-0.17.3 httpx-0.24.1 idna-3.4 importlib-resources-6.0.1 jinja2-3.1.2 jsonschema-4.17.3 lightkube-0.14.0 lightkube-models-1.28.1.4 markupsafe-2.1.3 ops-2.15.0 ordered-set-4.1.0 pkgutil-resolve-name-1.3.10 pyrsistent-0.19.3 pyyaml-6.0.1 requests-2.31.0 ruamel-yaml-0.17.32 ruamel-yaml-clib-0.2.7 serialized-data-interface-0.7.0 sniffio-1.3.0 tenacity-8.2.3 typing-extensions-4.11.0 urllib3-2.0.4 websocket-client-1.6.2 zipp-3.16.2                                                                      
:: Running external command ['/root/parts/charm/build/staging-venv/bin/pip', 'install', '--upgrade', '--no-binary', ':all:', 'cosl']                                         
::    :: Requirement already satisfied: cosl in ./staging-venv/lib/python3.8/site-packages (0.0.12)                                                                          
::    :: Collecting cosl                                                                                                                                                     
::    ::   Using cached cosl-0.0.15-py3-none-any.whl                                                                                                                         
::    :: Requirement already satisfied: ops in ./staging-venv/lib/python3.8/site-packages (from cosl) (2.15.0)     

Full execution log

Case 3 - does not fail

This case is even weirder, as it seems like charm-binary-python-packages is affecting the behaviour of installs.

  1. Keep the same library from before
  2. Keep the same requirements.txt from case 2
  3. Add the following part to the charmcraft.yaml
...
bases:
  - build-on:
    - name: ubuntu
      channel: "20.04"
    run-on:
    - name: ubuntu
      channel: "20.04"
parts:
  charm:
    charm-python-packages: [setuptools, pip]
    charm-binary-python-packages: [jinja2]
...
  1. Clean and pack again
$ charmcraft clean
Cleaning project 'my-charm'.                                                                                                                                                 
Cleaned project 'my-charm'.                                                                                                                                                  
$ charmcraft pack -v
  1. Observe the right version being installed with no upgrade attempts
::    :: Successfully installed anyio-4.0.0 attrs-23.1.0 certifi-2023.7.22 charmed-kubeflow-chisme-0.2.0 charset-normalizer-3.2.0 cosl-0.0.12 deepdiff-6.2.1 exceptiongroup-1.1.3 h11-0.14.0 httpcore-0.17.3 httpx-0.24.1 idna-3.4 importlib-resources-6.0.1 jinja2-3.1.2 jsonschema-4.17.3 lightkube-0.14.0 lightkube-models-1.28.1.4 markupsafe-2.1.3 ops-2.14.0 ordered-set-4.1.0 pkgutil-resolve-name-1.3.10 pyrsistent-0.19.3 pyyaml-6.0.1 requests-2.31.0 ruamel-yaml ruamel-yaml-clib serialized-data-interface-0.7.0 sniffio-1.3.0 tenacity-8.2.3 typing-extensions-4.11.0 urllib3-2.0.4 websocket-client-1.6.2 wheel-0.43.0 zipp-3.16.2                                                                       

Full execution log

Case 4 - fails

Do exactly the same as case 3, but the part in charmcraft.yaml will look like this:

parts:
  charm:
    charm-python-packages: [setuptools, pip]
    charm-binary-python-packages: [sh] <--- this is a different package 

Clean, build and observe the error again!

::    :: Installing collected packages: lightkube-models, zipp, websocket-client, urllib3, typing-extensions, tenacity, sniffio, ruamel-yaml-clib, pyyaml, pyrsistent, pkgutil-resolve-name, ordered-set, markupsafe, idna, h11, exceptiongroup, charset-normalizer, certifi, attrs, ruamel-yaml, requests, ops, jinja2, importlib-resources, deepdiff, anyio, jsonschema, httpcore, cosl, serialized-data-interface, httpx, lightkube, charmed-kubeflow-chisme                                                                          
::    :: Successfully installed anyio-4.0.0 attrs-23.1.0 certifi-2023.7.22 charmed-kubeflow-chisme-0.2.0 charset-normalizer-3.2.0 cosl-0.0.12 deepdiff-6.2.1 exceptiongroup-1.1.3 h11-0.14.0 httpcore-0.17.3 httpx-0.24.1 idna-3.4 importlib-resources-6.0.1 jinja2-3.1.2 jsonschema-4.17.3 lightkube-0.14.0 lightkube-models-1.28.1.4 markupsafe-2.1.3 ops-2.14.0 ordered-set-4.1.0 pkgutil-resolve-name-1.3.10 pyrsistent-0.19.3 pyyaml-6.0.1 requests-2.31.0 ruamel-yaml-0.17.32 ruamel-yaml-clib-0.2.7 serialized-data-interface-0.7.0 sniffio-1.3.0 tenacity-8.2.3 typing-extensions-4.11.0 urllib3-2.0.4 websocket-client-1.6.2 zipp-3.16.2                                                                      
:: Running external command ['/root/parts/charm/build/staging-venv/bin/pip', 'install', '--upgrade', '--no-binary', ':all:', 'cosl']                                         
::    :: Requirement already satisfied: cosl in ./staging-venv/lib/python3.8/site-packages (0.0.12)                                                                          
::    :: Collecting cosl                                                                                                                                                     
::    ::   Using cached cosl-0.0.15-py3-none-any.whl                                                                                                                         
::    :: Requirement already satisfied: ops in ./staging-venv/lib/python3.8/site-packages (from cosl) (2.14.0)       

Full execution log

Workaround (does not work)

As suggested by @carlcsaposs-canonical, we could use charm-strict-dependencies: true in our charms to solve the issue. I did it, but now I am hitting https://github.com/canonical/charmcraft/issues/1456.

Also, most of my team's charms won't work with this because we also define charm-python-packages, so adding charm-strict-dependencies will return - 'charm-python-packages' must not be set if 'charm-strict-dependencies' is enabled in field 'parts.charm.charm-strict-dependencies'

lengau commented 3 weeks ago

I'm not sure whether we're going to be able to fix this in the charm plugin, as any changes made therein are going to break other configurations.

Instead, we're going to work to replace the charm plugin with clearer, less tightly-coupled plugins that meet people's needs.

@DnPlas - the best way to work around this for your use case is to use charm-requirements and put the requirements that were previously in charm-python-packages into a requirements.txt file. If you need multiple requirements files, you can do that by specifying both files in charm-requirements.

lengau commented 1 day ago

Marking this as not planned, as it's too complex to implement in the charm plugin. The upcoming python and poetry plugins will support this.