I'm trying to run docker-compose
(which was installed via pip
), yet running into following error:
# pip install --quiet docker-compose
# docker-compose ps
/usr/local/lib/python2.7/dist-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
from cryptography.hazmat.backends import default_backend
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 7, in <module>
from compose.cli.main import main
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 24, in <module>
from ..config import ConfigurationError
File "/usr/local/lib/python2.7/dist-packages/compose/config/__init__.py", line 6, in <module>
from .config import ConfigurationError
File "/usr/local/lib/python2.7/dist-packages/compose/config/config.py", line 51, in <module>
from .validation import match_named_volumes
File "/usr/local/lib/python2.7/dist-packages/compose/config/validation.py", line 12, in <module>
from jsonschema import Draft4Validator
File "/usr/local/lib/python2.7/dist-packages/jsonschema/__init__.py", line 21, in <module>
from jsonschema._types import TypeChecker
File "/usr/local/lib/python2.7/dist-packages/jsonschema/_types.py", line 3, in <module>
from pyrsistent import pmap
File "/usr/local/lib/python2.7/dist-packages/pyrsistent/__init__.py", line 3, in <module>
from pyrsistent._pmap import pmap, m, PMap
File "/usr/local/lib/python2.7/dist-packages/pyrsistent/_pmap.py", line 98
) from e
^
SyntaxError: invalid syntax
#
# cat /etc/debian_version
9.13
# python2 --version
Python 2.7.13
# python3 --version
Python 3.5.3
#
Is there a way to force docker-compose
to use python3 instead of python
(python2
)?
@Micromegas / @MikaelH
# apt-get -q install python3-pip
# pip3 install --quiet docker-compose
# docker-compose ps
/usr/local/lib/python3.5/dist-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release ofcryptography. Please upgrade your Python.
from cryptography.hazmat.backends import default_backend
Name Command State Ports
------------------------------
#
This is the issue of the latest version(0.17.0) of pyrsistent.
You should install the past version.
I don't know if this will fix your problem but I hope it can help you troubleshoot. I had the same problem, but I tired to run
pip install docker-compose
in my gitlab CI.My configs before, where the problem occured was this:
What fixed it for me was the following:
So I guess @MikaelH's comment is spot on. Try to update to pip3 and make sure you have the necessary dependencies installed. That will depend on your environment/system. If you are on Debian you can use
sudo apt-get install python3
,sudo apt-get install python3-pip
andsudo apt-get install python3-dev libffi-dev libssl-dev
etc...As Python 2 is now end-of-life, the Python 3 version of pip should be used to install docker-compose. On Debian or Ubuntu it can be installed with:
Afterwards the Python 3 pip version can be used to install Docker Compose