CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team

Solution 1:

This is the issue of the latest version(0.17.0) of pyrsistent.

You should install the past version.

pip uninstall pyrsistent
pip install pyrsistent==0.16.0

Solution 2:

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:

    - apk update
    - apk upgrade
    - apk add python python-dev py-pip build-base libffi-dev openssl-dev libgcc
    - pip install docker-compose

What fixed it for me was the following:

    - apk update
    - apk upgrade
    - apk add build-base libffi-dev openssl-dev libgcc
    - apk add python3
    - apk add python3-dev
    - apk add py3-pip
    - pip3 install docker-compose

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 and sudo apt-get install python3-dev libffi-dev libssl-dev etc...

Solution 3:

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:

apt-get install python3-pip

Afterwards the Python 3 pip version can be used to install Docker Compose

pip3 install docker-compose