aws / amazon-mwaa-docker-images

Apache License 2.0
24 stars 11 forks source link

venv generation fails when pg_config is not installed. #52

Closed dhegberg closed 1 week ago

dhegberg commented 4 months ago

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


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.

dhegberg commented 2 weeks ago

https://github.com/aws/amazon-mwaa-docker-images/pull/145