aws/amazon-mwaa-docker-images

venv generation fails when pg_config is not installed.

dhegberg opened this issue · 1 comments

Describe the bug

The venv generation requires that either pg_config installed to build from source or psycopg2-binary from pip as an alternative to psycopg2-binary.

Ideally psycopg2-binary should be installed for a dev build, but pg_config used for a production build.

Barring that, the readme should include instructions for installing pg_config.


To Reproduce
Steps to reproduce the behavior:

When running set-up as per README:

$ python3 create_venvs.py

...
Collecting psycopg2
  Downloading psycopg2-2.9.9.tar.gz (384 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 384.9/384.9 kB 12.3 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      running egg_info
      creating /private/var/folders/7k/l2zfsmjj7gq3w4fyhg6jq1qr0000gn/T/pip-pip-egg-info-9tecja4g/psycopg2.egg-info
      writing /private/var/folders/7k/l2zfsmjj7gq3w4fyhg6jq1qr0000gn/T/pip-pip-egg-info-9tecja4g/psycopg2.egg-info/PKG-INFO
      writing dependency_links to /private/var/folders/7k/l2zfsmjj7gq3w4fyhg6jq1qr0000gn/T/pip-pip-egg-info-9tecja4g/psycopg2.egg-info/dependency_links.txt
      writing top-level names to /private/var/folders/7k/l2zfsmjj7gq3w4fyhg6jq1qr0000gn/T/pip-pip-egg-info-9tecja4g/psycopg2.egg-info/top_level.txt
      writing manifest file '/private/var/folders/7k/l2zfsmjj7gq3w4fyhg6jq1qr0000gn/T/pip-pip-egg-info-9tecja4g/psycopg2.egg-info/SOURCES.txt'

      Error: pg_config executable not found.

      pg_config is required to build psycopg2 from source.  Please add the directory
      containing pg_config to the $PATH or specify the full executable path with the
      option:

          python setup.py build_ext --pg-config /path/to/pg_config build ...

      or with the pg_config option in 'setup.cfg'.

      If you prefer to avoid building psycopg2 from source, please install the PyPI
      'psycopg2-binary' package instead.

      For further information please check the 'doc/src/install.rst' file (also at
      <https://www.psycopg.org/docs/install.html>).

      [end of output]



System Information

  • OS: Tested on MacOS and Arch linux.
  • Kernel version: [e.g. 6.2.0-39-generic]
  • System architecture: [e.g. x86_64]: Apple M2 for MacOS and x86_64 for linux.
  • Browser version (if the bug report is related to the web server): [e.g. Firefox 121.0 (64-bit)]
  • Airflow version used:
  • aws-mwaa-docker-images commit ID:

Expected behavior
A clear and concise description of what you expected to happen.


Screenshots
If applicable, add screenshots to help explain your problem.


Additional context
Add any other context about the problem here.