CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python

I'm trying to use docker-compose (which was installed via pip3), yet running into following warning everytime I do anything:

# docker-compose version
/usr/local/lib/python3.5/dist-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python.
  from cryptography.hazmat.backends import default_backend
docker-compose version 1.27.4, build unknown
docker-py version: 4.4.0
CPython version: 3.5.3
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019
# 

# cat /etc/debian_version 
9.13
# uname -a
Linux XXX 4.9.0-14-amd64 #1 SMP Debian 4.9.240-2 (2020-10-30) x86_64 GNU/Linux
# 

Is there a way to disable that warning or better yet addressing actual issue?

# python2 --version
Python 2.7.13
 python3 --version
Python 3.5.3
# 

python2 came with system and python3 was installed via apt-get install python3, or is my only option to update to later version of Debian?


Solution 1:

If you want to use the EOL Python 3.5 shipped with your distribution, you should install packages from the distribution if you want to avoid installing/updating to packages that legitimately warn you that you're running a soon-to-be unsupported version of Python (by the package, 3.5 is already EOL).

For your case, install python3-cryptography and hope that's it's not so outdated that docker-compose won't want to use it.

The alternative is to run docker-compose by invoking python3 -Wignore to suppress warnings.