9

I upgraded my system from python 2 to python 3, and now when I run my code:

from cryptography.hazmat.backends import default_backend

I am getting this error

/usr/local/lib/python3.6/site-packages/paramiko/transport.py:33:
CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python 
core team. Therefore, support for it is deprecated in cryptography and will be 
removed in a future release.

How to resolve it?

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Kanhaiya Singh
  • 93
  • 1
  • 1
  • 4
  • i upgraded my system from python 2 to python 3 now when i run my code i am getting this error /usr/local/lib/python3.6/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release. from cryptography.hazmat.backends import default_backend please give suitable answer on it – Kanhaiya Singh Jun 21 '22 at 02:41
  • All I see is a long error message. Please see [how to ask](https://stackoverflow.com/help/how-to-ask) a question on Stackoverflow :) – akaAbdullahMateen Jun 21 '22 at 02:43
  • i upgraded my system from python 2 to python 3 now when i run my code i am getting this error CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. this is my question – Kanhaiya Singh Jun 21 '22 at 03:08
  • What Python version are you running? If it's less than 3.6, you should upgrade to avoid this error message. – BrokenBenchmark Jun 21 '22 at 03:42

3 Answers3

7

on ubuntu

sudo apt-get upgrade docker-compose

docker-compose must be 2.X after that you need to refer old command to new command so do this

alias docker-compose='docker compose'
Ali Bildir
  • 125
  • 1
  • 3
4

I ran into this issue today and did some digging. Since the os is not provided I think you could consider one of the options below:

  1. Upgrade your python version. This might be the best option since python 3.6 reached its EOL.

  2. You might be using SSH in your code. Consider installing an older version of paramiko.

  3. You can suppress the warning with these lines of code before importing Paramiko:

    import warnings 
    warnings.filterwarnings(action='ignore',module='.*paramiko.*')
    

or If you want to be more selective about suppressing JUST that particular deprecation warning:

import warnings
from cryptography.utils import CryptographyDeprecationWarning
warnings.filterwarnings("ignore", category=CryptographyDeprecationWarning)

source for option 3

  1. Check if you installed it using pip when you needed to use conda.
Luv_Python
  • 194
  • 6
4

One of the solutions here suggests using

from cryptography.utils import CryptographyDeprecationWarning

That didn't work in my case, since importing the warning object caused the warning itself as well.

Although it's not an elegant solution (since "elegant" would be to upgrade Python), the following worked for me instead:

warnings.filterwarnings(action='ignore',message='Python 3.6 is no longer supported')
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
01drich
  • 41
  • 3