0

I'm trying to use Psycopg2 with Railway to connect django to postgres using this tutorial: https://dev.to/dennisivy11/easiest-django-postgres-connection-ever-with-railway-11h6.

However, I got "pg_config executable not found" when trying to deploy my django web app to Vercel.

This is what I get from Vercel:

Error: Command failed: pip3.9 install --disable-pip-version-check --target . --upgrade -r /vercel/path0/workout_log/requirements.txt
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [35 lines of output]
      /tmp/pip-build-env-wf1ju6t6/overlay/lib/python3.9/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
      !!
      
              ********************************************************************************
              The license_file parameter is deprecated, use license_files instead.
      
              By 2023-Oct-30, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.
      
              See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
              ********************************************************************************
      
      !!
        parsed = self.parsers.get(option_name, lambda x: x)(value)
      running egg_info
      writing psycopg2.egg-info/PKG-INFO
      writing dependency_links to psycopg2.egg-info/dependency_links.txt
      writing top-level names to psycopg2.egg-info/top_level.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]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

I installed the psycopg2-binary package in my environment but I'm still getting the same error when trying to deploy. I don't have postgresql installed on my computer because I figured I don't need it because I'm using Railway.

Any help would be appreciated.

Thanks.

Aysmith17
  • 13
  • 3
  • 1
    Either the executable is not in your `PATH`, or you didn't install the development package for PostgreSQL. – Laurenz Albe May 31 '23 at 06:35
  • 1
    And the `requirements.txt` specifies the build-from-source version of the library judging by the error message. – Richard Huxton May 31 '23 at 06:43
  • Do I need to install postgresSQL on my computer even though I'm using railway? @LaurenzAlbe – Aysmith17 May 31 '23 at 18:12
  • If it is looking for `pg_config`, it wants to know how PostgreSQL was configured and built, which typically means that it wants to compile software that links to PostgreSQL. That would certainly require PostgreSQL to be installed. – Laurenz Albe May 31 '23 at 19:12

0 Answers0