buildbot-docker-example-config icon indicating copy to clipboard operation
buildbot-docker-example-config copied to clipboard

simple buildbot_1 fails with ImportError: No module named psycopg2

Open akuanti opened this issue 7 years ago • 6 comments

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.

akuanti avatar Apr 18 '18 17:04 akuanti

Hi @akuanti, I tried to reproduce this issue but it worked as expected for me.

$ cd simple/
$ docker-compose up -d
$ docker-compose ps
      Name                     Command               State           Ports         
-----------------------------------------------------------------------------------
simple_buildbot_1   dumb-init /usr/src/buildbo ...   Up      0.0.0.0:8010->8010/tcp
simple_db_1         docker-entrypoint.sh postgres    Up      5432/tcp              
simple_worker_1     /usr/local/bin/dumb-init t ...   Up
$ open http://localhost:8010

How did you run docker-compose to get your container names not begin with simple_?

cristobal23 avatar Apr 28 '18 23:04 cristobal23

@cristobal23 the containers are up, but the process running in the simple_buildbot_1 container actually seems to be failing over and over. You should see this if you run docker-compose up with no -d. It doesn't actually work to visit http://localhost:8010.

akuanti avatar May 04 '18 15:05 akuanti

I realize now that you said you were able to open the page, so it seems you aren't getting the same results. I am on macOS, if that makes a difference.

akuanti avatar May 04 '18 15:05 akuanti

Interesting, I am macOS too. Perhaps try,

cd simple/
docker-compose stop
docker-compose rm
rm -r downloads/

then pull changes from master and try again?

I just did the above and it still worked for me.

cristobal23 avatar May 04 '18 20:05 cristobal23

Is there supposed to be a downloads directory? I don't have one.

akuanti avatar May 04 '18 20:05 akuanti

I don't think so, I just saw that in my git status.

cristobal23 avatar May 04 '18 21:05 cristobal23