oci-cli icon indicating copy to clipboard operation
oci-cli copied to clipboard

Add support for Python 3.12, install.sh fails (distutils module removed in Python 3.12 -- Ubuntu 24.04 users affected)

Open damntourists opened this issue 1 year ago • 5 comments

Previously, this issue was marked as completed without a resolution https://github.com/oracle/oci-cli/issues/778, however users have been responding saying that it's not corrected. I did not see any open issues regarding this (please correct me if I've missed it) so I'm resubmitting a request to have this resolved.

This is still an issue for Ubuntu 24.04 users, since it comes with Python 3.12.3 as the default python version which does not include distutils. The CLI installer marks Python 3.12.3 as OK when installing then breaks since distutils was deprecated and not included with this version of python.

Could we at least get the installer updated to recognize that Python 3.12 is not supported for the short term? Ideally we'd have a fallback built into the installer if a version higher than 3.11 is detected.

> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.1 LTS
Release:        24.04
Codename:       noble
[ ... ]
-- Verifying Python version.
-- Python version 3.12.3 okay.
[ ... ]
Installing collected packages: wcwidth, pytz, circuitbreaker, types-python-dateutil, terminaltables, six, PyYAML, pycparser, prompt-toolkit, jmespath, click, certifi, python-dateutil, cffi, cryptography, arrow, pyOpenSSL, oci, oci_cli
Successfully installed PyYAML-6.0.1 arrow-1.3.0 certifi-2024.8.30 cffi-1.17.1 circuitbreaker-2.0.0 click-8.0.4 cryptography-42.0.8 jmespath-0.10.0 oci-2.135.1 oci_cli-3.48.2 prompt-toolkit-3.0.43 pyOpenSSL-24.2.1 pycparser-2.22 python-dateutil-2.9.0.post0 pytz-2024.2 six-1.16.0 terminaltables-3.1.10 types-python-dateutil-2.9.0.20240906 wcwidth-0.2.13
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'distutils'
Traceback (most recent call last):
  File "/tmp/oci_cli_install_tmp_HxSR", line 722, in <module>
    main()
  File "/tmp/oci_cli_install_tmp_HxSR", line 705, in main
    venv_site_packages_directory = subprocess.check_output([venv_python_executable, '-c', 'from distutils.sysconfig import get_python_lib; print(get_python_lib())']).strip()
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/brett/lib/oracle-cli/bin/python', '-c', 'from distutils.sysconfig import get_python_lib; print(get_python_lib())']' returned non-zero exit status 1.

damntourists avatar Oct 02 '24 18:10 damntourists

Hi @damntourists , the OCI CLI does not yet support Python 3.12, so I suggest using Python 3.11 to resolve this issue, till CLI comes out with support for Python 3.12.

karthik-k-kamath avatar Oct 04 '24 03:10 karthik-k-kamath

FYI, we plan to support Python 3.12 in 1-2 months time

karthik-k-kamath avatar Oct 04 '24 03:10 karthik-k-kamath

Right, that is the issue I'm reporting. The CLI installer is incorrectly showing Python 3.12 as compatible and proceeds to try to install anyway. A fix would be to set a maximum compatible version instead of saying any version greater than or equal to X.

I'm curious why this ticket is closed when the issue is not resolved? You say it comes in 1-2mo time, however now the public has to take your word for it and a record of this issue can easily fall into the void. I had trouble finding information about this issue because the other ticket I mentioned was closed as completed.

damntourists avatar Oct 04 '24 17:10 damntourists

Thanks Brett for sharing more on why the incompatibility is not obvious when using the installer. I will reopen this till we release out the v3.12 compatibility support by Dec 2024

karthik-k-kamath avatar Oct 07 '24 03:10 karthik-k-kamath

Thanks @karthik-k-kamath!

damntourists avatar Oct 07 '24 17:10 damntourists

Support for python 3.12 for CLI is released from CLI version 3.50.2. install.sh now works in Ubuntu 24.04 with python 3.12.3

Closing this issue now.

himanshudas75 avatar Nov 20 '24 06:11 himanshudas75