compose: ImportError: No module named urllib.parse

I am getting this error and don’t know what should i do, I have tried to update six using pip install -U six but its up to date Requirement already up-to-date: six in /usr/lib/python2.7/site-packages what should i do in order to solve this issue ?

λ - ~ $ python --version
Python 2.7.8
λ - ~ $ docker-compose --version
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 9, in <module>
    load_entry_point('docker-compose==1.1.0', 'console_scripts', 'docker-compose')()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 348, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2311, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2025, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/site-packages/compose/__init__.py", line 2, in <module>
    from .service import Service  # noqa:flake8
  File "/usr/lib/python2.7/site-packages/compose/service.py", line 10, in <module>
    from docker.errors import APIError
  File "/usr/lib/python2.7/site-packages/docker/__init__.py", line 20, in <module>
    from .client import Client # flake8: noqa
  File "/usr/lib/python2.7/site-packages/docker/client.py", line 34, in <module>
    import websocket
  File "/usr/lib/python2.7/site-packages/websocket/__init__.py", line 22, in <module>
    from ._core import *
  File "/usr/lib/python2.7/site-packages/websocket/_core.py", line 41, in <module>
    from ._url import *
  File "/usr/lib/python2.7/site-packages/websocket/_url.py", line 23, in <module>
    from six.moves.urllib.parse import urlparse
ImportError: No module named urllib.parse

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 38

Most upvoted comments

I solved issue on my CentOS Linux release 7.1.1503 (Core) by running following commands:

pip install pyopenssl ndg-httpsclient pyasn1 pip install --upgrade urllib3 pip freeze | grep urllib urllib3==1.12

pip uninstall six pip install six pip install --upgrade six

I was having:

$ docker-compose --version
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 8, in <module>
    load_entry_point('docker-compose==1.3.1', 'console_scripts', 'docker-compose')()
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 558, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
    return ep.load()
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2355, in load
    return self.resolve()
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2361, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Library/Python/2.7/site-packages/compose/cli/main.py", line 10, in <module>
    from docker.errors import APIError
  File "/Library/Python/2.7/site-packages/docker/__init__.py", line 20, in <module>
    from .client import Client, AutoVersionClient # flake8: noqa
  File "/Library/Python/2.7/site-packages/docker/client.py", line 37, in <module>
    import websocket
  File "/Library/Python/2.7/site-packages/websocket/__init__.py", line 22, in <module>
    from ._core import *
  File "/Library/Python/2.7/site-packages/websocket/_core.py", line 41, in <module>
    from ._url import *
  File "/Library/Python/2.7/site-packages/websocket/_url.py", line 23, in <module>
    from six.moves.urllib.parse import urlparse
ImportError: No module named urllib.parse

solved my problem:

$ sudo pip install -U websocket 

@alejandrodnm +1