Compose: TypeError: load_config() got an unexpected keyword argument 'config_dict'

Created on 14 Nov 2018  Â·  7Comments  Â·  Source: docker/compose

Description of the issue

Tried to run docker-compose on a trivial docker-compose.yml, and it crashes with the error message given in the issue title :point_up:. Unable to get it working on anything since upgrading from docker-compose-1.8.0 to docker-compose-1.23.1.

Context information (for bug reports)

Output of docker-compose version

$ docker-compose version
docker-compose version 1.23.1, build b02f130
docker-py version: 3.5.1
CPython version: 3.5.2
OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016

Output of docker version

Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:24:56 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:23:21 2018
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker-compose config
(Make sure to add the relevant -f and other flags)

services:
  svc:
    image: postgres
version: '2.1'

Steps to reproduce the issue

  1. Install docker-compose using pip3 install --user -U docker-compose on Ubuntu 16.04.5 LTS.
  2. Run docker-compose up.

Observed result

docker-compose crashes with a stack trace.

Expected result

docker-compose should run a postgres database.

Stacktrace / full error message

Traceback (most recent call last):
  File "/home/pwaller/.local/bin/docker-compose", line 11, in <module>
    sys.exit(main())
  File "/home/pwaller/.local/lib/python3.5/site-packages/compose/cli/main.py", line 71, in main
    command()
  File "/home/pwaller/.local/lib/python3.5/site-packages/compose/cli/main.py", line 124, in perform_command
    project = project_from_options('.', options)
  File "/home/pwaller/.local/lib/python3.5/site-packages/compose/cli/command.py", line 42, in project_from_options
    compatibility=options.get('--compatibility'),
  File "/home/pwaller/.local/lib/python3.5/site-packages/compose/cli/command.py", line 123, in get_project
    host=host, environment=environment
  File "/home/pwaller/.local/lib/python3.5/site-packages/compose/cli/command.py", line 94, in get_client
    environment=environment, tls_version=get_tls_version(environment)
  File "/home/pwaller/.local/lib/python3.5/site-packages/compose/cli/docker_client.py", line 127, in docker_client
    client = APIClient(**kwargs)
  File "/home/pwaller/.local/lib/python3.5/site-packages/docker/api/client.py", line 113, in __init__
    config_dict=self._general_configs
TypeError: load_config() got an unexpected keyword argument 'config_dict'

Additional information

OS version / distribution, docker-compose install method, etc.

docker-compose was installed using pip3 install --user -U docker-compose on Ubuntu 16.04.5 LTS.

Seems related to this issue, which I did not find before writing the above: https://github.com/docker/docker-py/issues/1916

I was able to fix the issue by doing pip3 uninstall docker-py docker and then redoing the installation of docker-compose.

Figure it is worth posting this issue to this tracker at least so that anyone else searching for it here finds this, even if the issue isn't actually with docker-compose itself. Perhaps this can be fixed by preventing the simultaneous installation of docker and docker-py or detecting this case?

kinquestion

Most helpful comment

+1

All 7 comments

+1

I'm getting the same error.

Thanks for the report!

FWIW, we used to detect the conflict: #4383
We removed it earlier this year because docker-py has been obsolete for a long time now: #5639

As I wrote in #5639, the cons of checking for this outweigh the pros, so I don't expect we'll address this. If you're running into this error, you need to either uninstall docker-py, use a separate virtualenv for Compose, or use the binary we distribute instead.

Hi all,

I have the same issue on Mac but it's not clear to me how to fix it. I am not a python expert and my understanding is that docker-py is obsolete in some way. I installed everything using Docker Mac installer. Can anyone suggest me the exact steps to fix docker-compose on my Mac?

salvatores-MBP:docker-compose sasadangelo$ pip list docker | grep docker
docker 3.3.0
docker-compose 1.21.1
docker-py 1.10.6
docker-pycreds 0.2.3
dockerpty 0.4.1

Try this....

brew uninstall docker-compose
pip uninstall docker-py
pip uninstall docker-compose
pip3 install docker-compose

This assumes that you have pip associated with python2.7 and pip3 with python 3.x.

Just had this same issue and was going round in circles with it.

Uninstalling _docker_, _docker-compose_ & _docker-py_ and then installing _docker_ and _docker-compose_ resolved the issue for us.

NOT WORK FOR ME!

➜  docker-registry sudo pip3 install docker-compose
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting docker-compose
  Using cached https://files.pythonhosted.org/packages/50/7a/62f3691db4220c2783197dd97f2dddd81d41be12d21f086303d2f5bc17ef/docker_compose-1.27.4-py2.py3-none-any.whl
Requirement already satisfied: texttable<2,>=0.9.0 in /usr/lib/python3.6/site-packages (from docker-compose)
Requirement already satisfied: dockerpty<1,>=0.4.1 in /usr/lib/python3.6/site-packages (from docker-compose)
Requirement already satisfied: requests<3,>=2.20.0 in /usr/local/lib/python3.6/site-packages (from docker-compose)
Requirement already satisfied: distro<2,>=1.5.0 in /usr/local/lib/python3.6/site-packages (from docker-compose)
Requirement already satisfied: PyYAML<6,>=3.10 in /usr/local/lib64/python3.6/site-packages (from docker-compose)
Requirement already satisfied: cached-property<2,>=1.2.0 in /usr/lib/python3.6/site-packages (from docker-compose)
Requirement already satisfied: jsonschema<4,>=2.5.1 in /usr/lib/python3.6/site-packages (from docker-compose)
Requirement already satisfied: python-dotenv<1,>=0.13.0 in /usr/local/lib/python3.6/site-packages (from docker-compose)
Requirement already satisfied: websocket-client<1,>=0.32.0 in /usr/local/lib/python3.6/site-packages (from docker-compose)
Requirement already satisfied: docopt<1,>=0.6.1 in /usr/lib/python3.6/site-packages (from docker-compose)
Requirement already satisfied: docker[ssh]<5,>=4.3.1 in /usr/local/lib/python3.6/site-packages (from docker-compose)
Requirement already satisfied: six>=1.3.0 in /usr/local/lib/python3.6/site-packages (from dockerpty<1,>=0.4.1->docker-compose)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests<3,>=2.20.0->docker-compose)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests<3,>=2.20.0->docker-compose)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests<3,>=2.20.0->docker-compose)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests<3,>=2.20.0->docker-compose)
Requirement already satisfied: paramiko>=2.4.2; extra == "ssh" in /usr/local/lib/python3.6/site-packages (from docker[ssh]<5,>=4.3.1->docker-compose)
Requirement already satisfied: pynacl>=1.0.1 in /usr/local/lib64/python3.6/site-packages (from paramiko>=2.4.2; extra == "ssh"->docker[ssh]<5,>=4.3.1->docker-compose)
Requirement already satisfied: cryptography>=2.5 in /usr/local/lib64/python3.6/site-packages (from paramiko>=2.4.2; extra == "ssh"->docker[ssh]<5,>=4.3.1->docker-compose)
Requirement already satisfied: bcrypt>=3.1.3 in /usr/local/lib64/python3.6/site-packages (from paramiko>=2.4.2; extra == "ssh"->docker[ssh]<5,>=4.3.1->docker-compose)
Requirement already satisfied: cffi>=1.4.1 in /usr/local/lib64/python3.6/site-packages (from pynacl>=1.0.1->paramiko>=2.4.2; extra == "ssh"->docker[ssh]<5,>=4.3.1->docker-compose)
Requirement already satisfied: pycparser in /usr/local/lib/python3.6/site-packages (from cffi>=1.4.1->pynacl>=1.0.1->paramiko>=2.4.2; extra == "ssh"->docker[ssh]<5,>=4.3.1->docker-compose)
Installing collected packages: docker-compose
Successfully installed docker-compose-1.27.4
➜  docker-registry docker-compose up               
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/compose/cli/main.py", line 67, in main
    command()
  File "/usr/local/lib/python3.6/site-packages/compose/cli/main.py", line 123, in perform_command
    project = project_from_options('.', options)
  File "/usr/local/lib/python3.6/site-packages/compose/cli/command.py", line 69, in project_from_options
    environment_file=environment_file
  File "/usr/local/lib/python3.6/site-packages/compose/cli/command.py", line 132, in get_project
    verbose=verbose, version=api_version, context=context, environment=environment
  File "/usr/local/lib/python3.6/site-packages/compose/cli/docker_client.py", line 43, in get_client
    environment=environment, tls_version=get_tls_version(environment)
  File "/usr/local/lib/python3.6/site-packages/compose/cli/docker_client.py", line 170, in docker_client
    client = APIClient(**kwargs)
  File "/home/bige/.local/lib/python3.6/site-packages/docker/api/client.py", line 126, in __init__
    config_dict=self._general_configs, credstore_env=credstore_env,
TypeError: load_config() got an unexpected keyword argument 'config_dict'
➜  docker-registry docker version
Client: Docker Engine - Community
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 17:03:45 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46d9d
  Built:            Wed Sep 16 17:02:21 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.3.7
  GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
Was this page helpful?
0 / 5 - 0 ratings