Oracle Cloud Infrastructure CLI – How to fix CryptographyDeprecationWarning

WSL2 is a game-changer for developers like me. I prefer Oracle Linux 8 for coding in Ansible, Terraform, and OCI-CLI. Setting up Oracle Linux 8.8 on WSL2 from the Microsoft Store was easy. With OCI CLI configured within the Linux environment, managing Oracle Cloud Infrastructure resources became effortless.

WSL2 eliminates the need for additional virtualization software, providing a seamless Linux environment on Windows. This integration has significantly improved my development workflow, making tasks like deploying infrastructure and managing cloud resources more accessible.

In conclusion, WSL2’s integration with Windows and support for various Linux distributions, including Oracle Linux, has transformed the way I work. If you’re a developer, I highly recommend giving WSL2 a try – it might just revolutionize your workflow too.


We use the Oracle provided bash script to install the Oracle Cloud Infrastructure command-line interface without requiring root access for the OS user.

$ bash -c "$(curl -L"

The installer validates the versions in accordance with the OCI Command Line Interface (CLI) Supported Python Versions document on My Oracle Support (Doc ID 2922473.1). Here’s a snippet of the terminal output:

Running install script.
python3 /tmp/oci_cli_install_tmp_JFIu
-- Verifying Python version.
-- Python version 3.6.8 okay.

OCI-CLI Verification

The –version parameter is used to show the version of the installed oci-cli package. But what happens here? A message is shown which mentions that a cryptography component will not support existing Python 3.6 in future release.

Note: This does not impact the functionality of the OCI-CLI command-line tool, but the message is annoying. So why not update the OS delivered Python packages ton get rid of this message?

$ oci --version
/home/martinxberger/lib/oracle-cli/lib64/python3.6/site-packages/oci/_vendor/httpsig_cffi/ CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
  from cryptography.hazmat.backends import default_backend  # noqa: F401

Let’s go for Python 3.9

Since there are no other applications on the server reliant on Python, we have the flexibility to upgrade Python. However, caution is warranted. The current installed version is:

$ python3 --version
Python 3.6.8

As a root user or a user with sudo permissions, activate the module and proceed to install Python 3.9 along with the necessary packages and dependencies.

$ sudo dnf -y module enable python39
$ sudo dnf -y install python39

As the shortcut python3 points to version 3.6, we must change the alternative symbolic link. Select version 3.9 when you are prompted and verify the change.

$ sudo update-alternatives --config python3

There are 2 programs which provide 'python3'.

  Selection    Command
*+ 1           /usr/bin/python3.6
   2           /usr/bin/python3.9

Enter to keep the current selection[+], or type selection number: 2

$ sudo update-alternatives --list | grep python3
python3                 manual  /usr/bin/python3.9

The new version is shown.

$ python3 --version
Python 3.9.18

OCI-CLI Update

Re-run the bash installer as non-root OS user again. It will download and upgrade the OCI-CLI packages related to version 3.9.

bash -c "$(curl -L"

When prompted for removing the subdirectory /lib/oracle-cli, answer by Y to force the re-installation with the 3.9 related packages. Let other settings as is. The script will not overwrite your existing configuration if already oci setup –config was executed.

===> In what directory would you like to place the install? (leave blank to use '/home/martinxberger/lib/oracle-cli'):
-- Install directory '/home/martinxberger/lib/oracle-cli' is not empty and may contain a previous installation.

===> Remove this directory? (y/N): y


Let’s check the command again, the message about the cryptography package is not shown again.

Have fun with the Oracle Cloud Infrastructure command-line interface, without any deprecation messages now.

$ oci --version