Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

simple buildbot_1 fails with ImportError: No module named psycopg2

Open
#9 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
docker-compose, postgresql, python
Domain
databases, devops

Research direction

Start by running docker-compose up with the simple example and inspect the image or dependency configuration used by the buildbot service. Check how psycopg2 is installed and whether the PostgreSQL build prerequisites, including libpq-dev and pg_config, are available. Done means the example starts without the psycopg2 ImportError and completes the database upgrade.

Written by the indexing model from the issue text.

Description

When running docker-compose up with the simple example, I get the following over and over:

buildbot_1  | checking for running master
buildbot_1  | checking master.cfg
buildbot_1  | upgrading basedir
buildbot_1  | upgrading database (postgresql+psycopg2://buildbot:xxxx@db/buildbot)
buildbot_1  | Can't upgrade master yet. Waiting for database ready?
buildbot_1  | checking basedir
buildbot_1  | /usr/lib/python2.7/site-packages/buildbot/config.py:102: ConfigWarning: [0.9.0 and later] `buildbotNetUsageData` is not configured and defaults to
basic.
buildbot_1  | This parameter helps the buildbot development team to understand the installation base.
buildbot_1  | No personal information is collected.
buildbot_1  | Only installation software version info and plugin usage is sent.
buildbot_1  | You can `opt-out` by setting this variable to None.
buildbot_1  | Or `opt-in` for more information by setting it to "full".
buildbot_1  |
buildbot_1  |   category=ConfigWarning,
buildbot_1  | /usr/lib/python2.7/site-packages/buildbot/config.py:102: ConfigWarning: [0.9.0 and later] NOTE: `status` targets are deprecated and ignored They are replaced by reporters
buildbot_1  |   category=ConfigWarning,
buildbot_1  | problem while upgrading!:
buildbot_1  | Traceback (most recent call last):
buildbot_1  |   File "/usr/lib/python2.7/site-packages/buildbot/scripts/upgrade_master.py", line 121, in _upgradeMaster
buildbot_1  |     yield upgradeDatabase(config, master_cfg)
buildbot_1  | ImportError: No module named psycopg2

I tried installing psycopg2 manually, but it fails because it can't find the pg_config executable.

/var/lib/buildbot # pip install psycopg2
Collecting psycopg2
  Downloading https://files.pythonhosted.org/packages/74/83/51580322ed0e82cba7ad8e0af590b8fb2cf11bd5aaa1ed872661bd36f462/psycopg2-2.7.4.tar.gz (425kB)
    100% |████████████████████████████████| 430kB 4.4MB/s
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/psycopg2.egg-info
    writing pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/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
    <http://initd.org/psycopg/docs/install.html>).


    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-Q8qcHR/psycopg2/

When I try to install psycopg2-binary, it still tries to build from source (I'm guessing because none of the wheels are compatible?).

/var/lib/buildbot # pip install psycopg2-binary
Collecting psycopg2-binary
  Downloading https://files.pythonhosted.org/packages/77/09/4991fcd9a8f4bea1ee3948e1729fa17c184d25bd10809bacc143626361b9/psycopg2-binary-2.7.4.tar.gz (426kB)
    100% |████████████████████████████████| 430kB 6.4MB/s
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/psycopg2_binary.egg-info
    writing pip-egg-info/psycopg2_binary.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/psycopg2_binary.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/psycopg2_binary.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/psycopg2_binary.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
    <http://initd.org/psycopg/docs/install.html>).


    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-2kFAwj/psycopg2-binary/

I believe that libpq-dev needs to be installed: http://initd.org/psycopg/docs/install.html#build-prerequisites for this installation to work properly.

Dominant language
Python
Stars
36
Forks
181
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from buildbot/buildbot-docker-example-config

All issues in buildbot/buildbot-docker-example-config

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.