Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose #4874

Closed
NathanTheGr8 opened this issue May 28, 2017 · 14 comments
Closed

docker-compose #4874

NathanTheGr8 opened this issue May 28, 2017 · 14 comments

Comments

@NathanTheGr8
Copy link

NathanTheGr8 commented May 28, 2017

I just tried to install docker-compose on a fresh Ubuntu 16.04 64bit / Linux 4.8.0-36-generic system. I get this

Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 9, in <module>
    load_entry_point('docker-compose==1.8.0', 'console_scripts', 'docker-compose')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 561, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 17, in <module>
    from ..bundle import get_image_digests
  File "/usr/lib/python2.7/dist-packages/compose/bundle.py", line 14, in <module>
    from .service import format_environment
  File "/usr/lib/python2.7/dist-packages/compose/service.py", line 13, in <module>
    from docker.utils import LogConfig
ImportError: cannot import name LogConfig

It seems this is similar to this issue so here is the output of pip list

pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
acme (0.14.2)
backports.ssl-match-hostname (3.5.0.1)
bernhard (0.2.5)
bottle (0.12.13)
cached-property (1.3.0)
cassandra-driver (3.10)
certbot (0.14.2)
certifi (2017.4.17)
chardet (3.0.3)
colorama (0.3.9)
ConfigArgParse (0.11.0)
configobj (5.0.6)
CouchDB (1.1)
cryptography (1.7.1)
cycler (0.10.0)
dnspython (1.15.0)
docker (2.3.0)
docker-compose (1.8.0)
docker-py (1.9.0)
docker-pycreds (0.2.1)
dockerpty (0.4.1)
docopt (0.6.2)
elasticsearch (5.4.0)
enum-compat (0.0.2)
enum34 (1.1.6)
funcsigs (0.4)
functools32 (3.2.3.post2)
futures (3.1.1)
Glances (2.10)
idna (2.5)
influxdb (4.1.0)
ipaddr (2.1.11)
ipaddress (1.0.18)
jsonschema (2.6.0)
kafka-python (1.3.3)
libvirt-python (1.3.1)
matplotlib (2.0.2)
mock (1.3.0)
ndg-httpsclient (0.4.2)
netifaces (0.10.5)
numpy (1.12.1)
nvidia-ml-py (375.53.1)
parsedatetime (2.1)
pbkdf2 (1.3)
pbr (1.8.0)
pika (0.10.0)
pip (9.0.1)
ply (3.10)
potsdb (1.0.3)
prometheus-client (0.0.19)
protobuf (3.3.0)
psutil (5.2.2)
py-cpuinfo (3.2.0)
pyasn1 (0.2.3)
pycryptodome (3.4.6)
pygobject (3.20.0)
PyICU (1.9.2)
pymdstat (0.4.2)
pyOpenSSL (17.0.0)
pyparsing (2.2.0)
pyRFC3339 (1.0)
pysmi (0.1.3)
pysnmp (4.3.5)
pystache (0.5.4)
python-dateutil (2.6.0)
python2-pythondialog (3.3.0)
pytz (2014.10)
PyYAML (3.12)
pyzmq (16.0.2)
requests (2.11.1)
scandir (1.5)
setuptools (33.1.1)
six (1.10.0)
statsd (3.2.1)
subprocess32 (3.2.7)
texttable (0.8.8)
urllib3 (1.21.1)
websocket-client (0.40.0)
wheel (0.29.0)
wifi (0.3.8)
zeroconf (0.19.0)
zope.component (4.2.2)
zope.event (4.2.0)
zope.hookable (4.0.4)
zope.interface (4.1.3)

Running docker-py upgrade doesnt' seem to work

nathan@server:~$ docker-py upgrade
docker-py: command not found

Other system information
Docker 17.05.0-ce)
pip 9.0.1 from /home/nathan/.local/lib/python2.7/site-packages (python 2.7)

@shin-
Copy link

shin- commented May 31, 2017

pip uninstall docker-py; pip install -U docker-compose

@shin-
Copy link

shin- commented May 31, 2017

If it's a fresh install, I'm not sure how you ended up with docker-compose 1.8.0 which is almost 1 year old. But regardless, the above command should sort things out. In the future, make sure to use virtualenv to keep conflicting dependencies (in this case docker and docker-py) from interfering with each other.

Related: #4344

@NathanTheGr8
Copy link
Author

NathanTheGr8 commented Jun 1, 2017

I assume it was something idiotic I did when I couldn't get compose to install. Sadly I am still having problems. Thank you for your help!

nathan@server:~$ pip uninstall docker-py; pip install -U docker-compose
Uninstalling docker-py-1.9.0:
  /usr/lib/python2.7/dist-packages/docker
  /usr/lib/python2.7/dist-packages/docker_py-1.9.0.egg-info
Proceed (y/n)? y
Exception:
Traceback (most recent call last):
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/commands/uninstall.py", line 76, in run
    requirement_set.uninstall(auto_confirm=options.yes)
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 346, in uninstall
    req.uninstall(auto_confirm=auto_confirm)
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/usr/lib/python2.7/shutil.py", line 300, in move
    rmtree(src)
  File "/usr/lib/python2.7/shutil.py", line 252, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "/usr/lib/python2.7/shutil.py", line 250, in rmtree
    os.remove(fullname)
OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/dist-packages/docker/constants.py'
Collecting docker-compose
  Downloading docker_compose-1.13.0-py2.py3-none-any.whl (94kB)
    100% |████████████████████████████████| 102kB 634kB/s 
Requirement already up-to-date: six<2,>=1.3.0 in /usr/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: dockerpty<0.5,>=0.4.1 in /usr/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: texttable<0.9,>=0.8.1 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: cached-property<2,>=1.2.0 in /usr/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: jsonschema<3,>=2.5.1 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: ipaddress>=1.0.16; python_version < "3.3" in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: backports.ssl-match-hostname>=3.5; python_version < "3.5" in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: docker<3.0,>=2.2.1 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: enum34<2,>=1.0.4; python_version < "3.4" in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: docopt<0.7,>=0.6.1 in /usr/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: colorama<0.4,>=0.3.7 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: PyYAML<4,>=3.10 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: requests!=2.11.0,<2.12,>=2.6.1 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: websocket-client<1.0,>=0.32.0 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: functools32; python_version == "2.7" in /usr/local/lib/python2.7/dist-packages (from jsonschema<3,>=2.5.1->docker-compose)
Requirement already up-to-date: docker-pycreds>=0.2.1 in /usr/local/lib/python2.7/dist-packages (from docker<3.0,>=2.2.1->docker-compose)
Installing collected packages: docker-compose
  Found existing installation: docker-compose 1.8.0
    Uninstalling docker-compose-1.8.0:
Exception:
Traceback (most recent call last):
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/usr/lib/python2.7/shutil.py", line 303, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/bin/docker-compose'
nathan@server:~$ sudo !!
sudo pip uninstall docker-py; pip install -U docker-compose
The directory '/home/nathan/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Uninstalling docker-py-1.9.0:
  /usr/lib/python2.7/dist-packages/docker
  /usr/lib/python2.7/dist-packages/docker_py-1.9.0.egg-info
Proceed (y/n)? y
  Successfully uninstalled docker-py-1.9.0
The directory '/home/nathan/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting docker-compose
  Using cached docker_compose-1.13.0-py2.py3-none-any.whl
Requirement already up-to-date: six<2,>=1.3.0 in /usr/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: dockerpty<0.5,>=0.4.1 in /usr/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: texttable<0.9,>=0.8.1 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: cached-property<2,>=1.2.0 in /usr/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: jsonschema<3,>=2.5.1 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: ipaddress>=1.0.16; python_version < "3.3" in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: backports.ssl-match-hostname>=3.5; python_version < "3.5" in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: docker<3.0,>=2.2.1 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: enum34<2,>=1.0.4; python_version < "3.4" in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: docopt<0.7,>=0.6.1 in /usr/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: colorama<0.4,>=0.3.7 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: PyYAML<4,>=3.10 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: requests!=2.11.0,<2.12,>=2.6.1 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: websocket-client<1.0,>=0.32.0 in /usr/local/lib/python2.7/dist-packages (from docker-compose)
Requirement already up-to-date: functools32; python_version == "2.7" in /usr/local/lib/python2.7/dist-packages (from jsonschema<3,>=2.5.1->docker-compose)
Requirement already up-to-date: docker-pycreds>=0.2.1 in /usr/local/lib/python2.7/dist-packages (from docker<3.0,>=2.2.1->docker-compose)
Installing collected packages: docker-compose
  Found existing installation: docker-compose 1.8.0
    Uninstalling docker-compose-1.8.0:
Exception:
Traceback (most recent call last):
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/home/nathan/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/usr/lib/python2.7/shutil.py", line 303, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/bin/docker-compose'

@shin-
Copy link

shin- commented Jun 1, 2017 via email

@NathanTheGr8
Copy link
Author

that is what I did the second time. Could you just advise me what I need to do to blow docker away and start fresh?

@NathanTheGr8
Copy link
Author

I was able to fix it with the sudo -H options

sudo -H pip install docker-compose

@hosquiat
Copy link

hosquiat commented Jun 1, 2019

pip uninstall docker-py; pip install -U docker-compose

This definitely helped with my issue:

Building event-webhook
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 11, in <module>
    load_entry_point('docker-compose==1.17.1', 'console_scripts', 'docker-compose')()
  File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 68, in main
    command()
  File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 121, in perform_command
    handler(command, command_options)
  File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 952, in up
    start=not no_start
  File "/usr/lib/python2.7/dist-packages/compose/project.py", line 431, in up
    svc.ensure_image_exists(do_build=do_build)
  File "/usr/lib/python2.7/dist-packages/compose/service.py", line 318, in ensure_image_exists
    self.build()
  File "/usr/lib/python2.7/dist-packages/compose/service.py", line 923, in build
    shmsize=parse_bytes(build_opts.get('shm_size')) if build_opts.get('shm_size') else None,
TypeError: build() got an unexpected keyword argument 'stream'

Had to run it as SUDO

@amitgunjal26
Copy link

amitgunjal26 commented Jan 21, 2020

While running pip uninstall docker-py; pip install -U docker-compose on Cent OS 7 it is throwing
Found existing installation: subprocess32 3.2.6 ERROR: Cannot uninstall 'subprocess32'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

and the problem still exists

  File "/bin/docker-compose", line 11, in <module>
    load_entry_point('docker-compose==1.18.0', 'console_scripts', 'docker-compose')()
  File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 71, in main
    command()
  File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 124, in perform_command
    handler(command, command_options)
  File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 959, in up
    start=not no_start
  File "/usr/lib/python3.6/site-packages/compose/project.py", line 452, in up
    svc.ensure_image_exists(do_build=do_build)
  File "/usr/lib/python3.6/site-packages/compose/service.py", line 308, in ensure_image_exists
    self.build()
  File "/usr/lib/python3.6/site-packages/compose/service.py", line 967, in build
    'memory': parse_bytes(memory) if memory else None
  File "/usr/lib/python3.6/site-packages/docker/api/build.py", line 142, in build
    raise TypeError("You must specify a directory to build in path")

@Luskan777
Copy link

Hello,
Probably the path of your docker-compose.yml file is wrong, in my case, in the context part I had put the path with Dokerfile at the end, in my example:
context: ./bin/web/Dockerfile.
I just needed to remove the Dockerfile, and it was "./bin/web/".
That's how I managed to solve

@vnaz
Copy link

vnaz commented Aug 13, 2021

In my case the docker was not started. Check it with docker info and if it is not started
use
systemctl start docker
systemctl enable docker

@emirom
Copy link

emirom commented Apr 22, 2022

Reinstalling docker-compose worked for me
First, remove the old version:

If installed via apt-get
sudo apt-get remove docker-compose

If installed via curl
sudo rm /usr/local/bin/docker-compose

If installed via pip
pip uninstall docker-compose

Now Install the new one:
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
then
sudo chmod +x /usr/local/bin/docker-compose

@erik1110
Copy link

Reinstalling docker-compose worked for me First, remove the old version:

If installed via apt-get sudo apt-get remove docker-compose

If installed via curl sudo rm /usr/local/bin/docker-compose

If installed via pip pip uninstall docker-compose

Now Install the new one: sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose then sudo chmod +x /usr/local/bin/docker-compose

This also worked for me! Thanks a lot

@jungsikjeong
Copy link

@emirom Thank you so much. You are a god!

@isophel
Copy link

isophel commented Nov 4, 2024

T

Reinstalling docker-compose worked for me First, remove the old version:
If installed via apt-get sudo apt-get remove docker-compose
If installed via curl sudo rm /usr/local/bin/docker-compose
If installed via pip pip uninstall docker-compose
Now Install the new one: sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose then sudo chmod +x /usr/local/bin/docker-compose

This also worked for me! Thanks a lot

This worked for me as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants