chatgpt-retrieval-plugin icon indicating copy to clipboard operation
chatgpt-retrieval-plugin copied to clipboard

Cannot install psychopg on a mac m1

Open pgmyrek opened this issue 1 year ago • 2 comments

I followed the readme until step 7 (poetry install) and then I get this error:

Installing psycopg2 (2.9.6): Failed

ChefBuildError

Backend subprocess exited when trying to invoke get_requires_for_build_wheel

/private/var/folders/0_/md9w_yqd5xv0rv8cl52gglph0000gn/T/tmpn4uvqp_k/.venv/lib/python3.10/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).

at /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/poetry/installation/chef.py:152 in _prepare 148│ 149│ error = ChefBuildError("\n\n".join(message_parts)) 150│ 151│ if error is not None: → 152│ raise error from None 153│ 154│ return path 155│ 156│ def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with psycopg2 (2.9.6) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "psycopg2 (==2.9.6)"'.

pgmyrek avatar May 31 '23 13:05 pgmyrek

I ran into this problem and found an answer.

The issue is this part

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:

https://stackoverflow.com/questions/11618898/pg-config-executable-not-found

cowile avatar May 31 '23 20:05 cowile

You may wanna install the package 'psycopg2-binary' and not 'psycopg2': poetry add psycopg2-binary Installation — Psycopg 2.9.6 documentation

theCollectiv avatar Jul 22 '23 15:07 theCollectiv