Todd de Quincey
08/07/2023, 10:24 AMError: pg_config executable not found.
error in GitHub actionsTodd de Quincey
08/07/2023, 10:24 AMBuild and deploy to Dagster Cloud serverless
step. See log output below.
This is similar to this thread, however there doesn’t appear to be a resolution on that thread.
Can someone please assist?
#10 68.47 Collecting dbt-core
#10 68.50 Downloading dbt-core-0.14.4.tar.gz (540 kB)
#10 68.51 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 540.3/540.3 kB 53.2 MB/s eta 0:00:00
#10 68.59 Preparing metadata (setup.py): started
#10 68.90 Preparing metadata (setup.py): finished with status 'done'
#10 68.93 Collecting dbt-postgres==0.14.4
#10 68.94 Downloading dbt-postgres-0.14.4.tar.gz (7.6 kB)
#10 68.95 Preparing metadata (setup.py): started
#10 69.21 Preparing metadata (setup.py): finished with status 'done'
#10 69.38 Collecting psycopg2<2.8,>=2.7
#10 69.45 Downloading psycopg2-2.7.7.tar.gz (427 kB)
#10 69.46 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 427.5/427.5 kB 38.3 MB/s eta 0:00:00
#10 69.54 Preparing metadata (setup.py): started
#10 69.84 Preparing metadata (setup.py): finished with status 'error'
#10 69.85 error: subprocess-exited-with-error
#10 69.85
#10 69.85 × python setup.py egg_info did not run successfully.
#10 69.85 │ exit code: 1
#10 69.85 ╰─> [23 lines of output]
#10 69.85 running egg_info
#10 69.85 creating /tmp/pip-pip-egg-info-9l56y9cr/psycopg2.egg-info
#10 69.85 writing /tmp/pip-pip-egg-info-9l56y9cr/psycopg2.egg-info/PKG-INFO
#10 69.85 writing dependency_links to /tmp/pip-pip-egg-info-9l56y9cr/psycopg2.egg-info/dependency_links.txt
#10 69.85 writing top-level names to /tmp/pip-pip-egg-info-9l56y9cr/psycopg2.egg-info/top_level.txt
#10 69.85 writing manifest file '/tmp/pip-pip-egg-info-9l56y9cr/psycopg2.egg-info/SOURCES.txt'
#10 69.85
#10 69.85 Error: pg_config executable not found.
#10 69.85
#10 69.85 pg_config is required to build psycopg2 from source. Please add the directory
#10 69.85 containing pg_config to the $PATH or specify the full executable path with the
#10 69.85 option:
#10 69.85
#10 69.85 python setup.py build_ext --pg-config /path/to/pg_config build ...
#10 69.85
#10 69.85 or with the pg_config option in 'setup.cfg'.
#10 69.85
#10 69.85 If you prefer to avoid building psycopg2 from source, please install the PyPI
#10 69.85 'psycopg2-binary' package instead.
#10 69.85
#10 69.85 For further information please check the 'doc/src/install.rst' file (also at
#10 69.85 <<http://initd.org/psycopg/docs/install.html>>).
#10 69.85
#10 69.85 [end of output]
#10 69.85
#10 69.85 note: This error originates from a subprocess, and is likely not a problem with pip.
#10 69.86 error: metadata-generation-failed
#10 69.86
#10 69.86 × Encountered error while generating package metadata.
#10 69.86 ╰─> See above for output.
#10 69.86
#10 69.86 note: This is an issue with the package mentioned above, not pip.
#10 69.86 hint: See above for details.
#10 70.05
#10 70.05 [notice] A new release of pip is available: 23.0.1 -> 23.2.1
#10 70.05 [notice] To update, run: pip install --upgrade pip
#10 ERROR: process "/bin/sh -c if [ -f \"setup.py\" ]; then pip install .; fi" did not complete successfully: exit code: 1
------
> [4/9] RUN if [ -f "setup.py" ]; then pip install .; fi:
69.86 error: metadata-generation-failed
69.86
69.86 × Encountered error while generating package metadata.
69.86 ╰─> See above for output.
69.86
69.86 note: This is an issue with the package mentioned above, not pip.
69.86 hint: See above for details.
70.05
Notice: 70.05 [notice] A new release of pip is available: 23.0.1 -> 23.2.1
Notice: 70.05 [notice] To update, run: pip install --upgrade pip
------
Dockerfile:13
--------------------
12 | # copying all other files
13 | >>> RUN if [ -f "setup.py" ]; then \
14 | >>> pip install .; \
15 | >>> fi
16 |
--------------------
ERROR: failed to solve: process "/bin/sh -c if [ -f \"setup.py\" ]; then pip install .; fi" did not complete successfully: exit code: 1
Error: buildx failed with: ERROR: failed to solve: process "/bin/sh -c if [ -f \"setup.py\" ]; then pip install .; fi" did not complete successfully: exit code: 1
Todd de Quincey
08/07/2023, 10:25 AMsetup.py
file looks like thisJoe
08/07/2023, 7:59 PMJoe
08/07/2023, 8:00 PMTodd de Quincey
08/07/2023, 9:37 PMTodd de Quincey
08/07/2023, 9:37 PMTodd de Quincey
08/07/2023, 9:38 PMJoe
08/07/2023, 9:42 PMENABLE_FAST_DEPLOYS: 'true'
in your github action envsJoe
08/07/2023, 9:44 PMJoe
08/07/2023, 9:44 PMJoe
08/07/2023, 10:58 PM#10 69.85 If you prefer to avoid building psycopg2 from source, please install the PyPI
#10 69.85 'psycopg2-binary' package instead.
might be the real issue so maybe adding psycopg2-binary
to your setup.py or using the lifecycle hook scripts to install postgresTodd de Quincey
08/08/2023, 4:37 AMENABLE_FAST_DEPLOYS: 'true'
, but that caused the first step in the build to fail (see the attached).
So I set that to False, and everything worked fine and now I get the above error. I tried just installing the binary, but no love either. I will have a play around again today and see where I get.Todd de Quincey
08/08/2023, 4:38 AMdagster_cloud
dependency. I will add that today and see if that fixes itTodd de Quincey
08/08/2023, 4:39 AMTodd de Quincey
08/08/2023, 8:21 AMTodd de Quincey
08/08/2023, 11:19 AMJoe
08/08/2023, 11:38 AMchmod +x ./dagster_cloud_pre_install.sh
Todd de Quincey
08/08/2023, 11:46 AMTodd de Quincey
08/08/2023, 11:49 AMJoe
08/08/2023, 11:56 AMJoe
08/08/2023, 11:57 AMJoe
08/08/2023, 11:57 AMTodd de Quincey
08/08/2023, 12:39 PMError: pg_config executable not found.
).
Your original suggestion to more simply use the pex
deployment worked, but unfortunately I need to use the dagster_cloud_post_install
hook to forward the local ports via our SSH server. So I have been forced back to the docker deploy. But, obviously I need to resolve this issue first.
So as you can see, I’ve gone around in a few loops trying to get this to work so far.
Per my quick scour of the web, installing the binary in the pre-hook like so should fix my original issue (if not there are a few other ways to do this, but this is the first port of call)
#!/bin/sh
python -m pip install psycopg2-binary
Joe
08/08/2023, 12:41 PMJoe
08/08/2023, 12:43 PMpython3.8 -m
might also be the issue (or whatever version you have configured)Joe
08/08/2023, 12:44 PMpython -m
should workTodd de Quincey
08/08/2023, 12:50 PMgit update-index --chmod=+x ./dagster_cloud_pre_install.sh
)? I didn’t know you could do this with git until todayJoe
08/08/2023, 12:52 PMchmod +x ./dagster_cloud_pre_install.sh
and then git add ./dagster_cloud_pre_install.sh
Joe
08/08/2023, 12:52 PMJoe
08/08/2023, 12:53 PMls -l ./dagster_cloud_pre_install.sh
Todd de Quincey
08/08/2023, 12:56 PMError: pg_config executable not found.
error, but I should be able to work through that now
TIL a few things! So thanks for your patience and assistance, Joe. Much appreciatedJoe
08/08/2023, 12:57 PMTodd de Quincey
08/08/2023, 12:58 PMTodd de Quincey
08/09/2023, 2:30 PMREDACTED
Joe
08/09/2023, 2:32 PMI am presuming that post the deployment, the below script is actually run on the Dagster Cloud servers / in our docker containers?the script will only be run at build time in github actions not on startup in dagster cloud
Joe
08/09/2023, 2:40 PMTodd de Quincey
08/09/2023, 2:43 PMTodd de Quincey
08/09/2023, 2:44 PMJoe
08/09/2023, 2:46 PMTodd de Quincey
08/09/2023, 2:46 PMTodd de Quincey
08/09/2023, 2:47 PMTodd de Quincey
08/09/2023, 2:47 PMJoe
08/09/2023, 2:47 PMTodd de Quincey
08/09/2023, 2:48 PMTodd de Quincey
08/09/2023, 3:31 PMAttributeError: 'ResourceDefinition' object has no attribute 'get_tunnel'
, but then if I drop the get_tunnel
, how/where do I define the tunnel details?
assets = with_resources(
load_assets_from_dbt_project(
profiles_dir=DBT_PROJECT_PATH,
project_dir=DBT_PROFILES,
else None,
use_build_command=False, # Delete when ready to launch to run tests
display_raw_sql=True,
),
{
"dbt": dbt_cli_resource.configured(
{
"project_dir": DBT_PROJECT_PATH,
"profiles_dir": DBT_PROFILES,
},
),
"ssh": ssh_resource.configured(
{
"remote_host": os.getenv("SSH_HOST"),
"remote_port": 22,
"username": os.getenv("SSH_USER"),
"key_file": "~/.ssh/dagster_rsa",
}
).get_tunnel(remote_port=5439, remote_host="localhost", local_port=5439),
},
)
Joe
08/09/2023, 3:34 PMTodd de Quincey
08/09/2023, 3:44 PMload_assets_from_dbt_project
. I have asked this in the main support channelJoe
08/09/2023, 3:45 PM