cookiecutter / cookiecutter-django

Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.
https://cookiecutter-django.readthedocs.io
BSD 3-Clause "New" or "Revised" License
12.02k stars 2.88k forks source link

Preparing metadata (pyproject.toml) ... error: [Errno 2] No such file or directory: 'pg_config' #5165

Closed Rhiz3K closed 3 months ago

Rhiz3K commented 3 months ago

What happened?

$ pip install -r requirements/local.txt ... Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error error: [Errno 2] No such file or directory: 'pg_config' ...

What should've happened instead?

"sudo apt-get install libpq-dev" should've been included https://stackoverflow.com/questions/11618898/pg-config-executable-not-found

Additional details

{
  "cookiecutter": {
    ...
    "username_type": "username",
    "timezone": "Europe/Prague",
    "windows": "n",
    "editor": "VS Code",
    "use_docker": "y",
    "postgresql_version": "16",
    "cloud_provider": "None",
    "mail_service": "Other SMTP",
    "use_async": "y",
    "use_drf": "n",
    "frontend_pipeline": "None",
    "use_celery": "n",
    "use_mailpit": "y",
    "use_sentry": "n",
    "use_whitenoise": "y",
    "use_heroku": "n",
    "ci_tool": "Github",
    "keep_local_envs_in_vcs": "y",
    "debug": "y",
    "_template": "https://github.com/cookiecutter/cookiecutter-django",
    ...
    "_repo_dir": "/home/coder/.cookiecutters/cookiecutter-django",
    "_checkout": null
  }
Logs:
$ pip install -r requirements/local.txt
...
 Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      running dist_info
      creating /tmp/pip-modern-metadata-bm6tw1x6/psycopg_c.egg-info
      writing /tmp/pip-modern-metadata-bm6tw1x6/psycopg_c.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-modern-metadata-bm6tw1x6/psycopg_c.egg-info/dependency_links.txt
      writing top-level names to /tmp/pip-modern-metadata-bm6tw1x6/psycopg_c.egg-info/top_level.txt
      writing manifest file '/tmp/pip-modern-metadata-bm6tw1x6/psycopg_c.egg-info/SOURCES.txt'
      couldn't run 'pg_config' --includedir: [Errno 2] No such file or directory: 'pg_config'
      error: [Errno 2] No such file or directory: 'pg_config'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
luzfcb commented 3 months ago

@Rhiz3K the non-python dependencies are available/documented in the utility directory https://github.com/cookiecutter/cookiecutter-django/tree/315724b797d0150cf0e869fce3963d74fd167545/%7B%7Bcookiecutter.project_slug%7D%7D/utility


cd utility
sudo ./install_os_dependencies.sh install

Please run it, and if it does not solve the problem, reopen/comment on this issue.