oracle / oracle/oci-cli

bug: cant install `oci-cli` on Ubuntu 24.04 with Python 3.12

Open
#988 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
669
Forks
236
Avg merge
1m
Merged PRs (30d)
4

Description

Explanation
Even though official documentation says the oci-cli is supported on Python 3.12 but for Ubuntu 24.04 I am facing python3-venv failure issue.

Docs: https://docs.oracle.com/en-us/iaas/Content/API/Concepts/cliconcepts.htm

Installation Logs

ganu@luxorpc:~/Documents/Projects/CNCF/automation$ bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16926  100 16926    0     0  56685      0 --:--:-- --:--:-- --:--:-- 56608

    ******************************************************************************
    You have started the OCI CLI Installer in interactive mode. If you do not wish
    to run this in interactive mode, please include the --accept-all-defaults option.
    If you have the script locally and would like to know more about
    input options for this script, then you can run:
    ./install.sh -h
    If you would like to know more about input options for this script, refer to:
    https://github.com/oracle/oci-cli/blob/master/scripts/install/README.rst
    ******************************************************************************
Downloading Oracle Cloud Infrastructure CLI install script from https://raw.githubusercontent.com/oracle/oci-cli/v3.2.1/scripts/install/install.py to /tmp/oci_cli_install_tmp_WSY9.
####################################################################################################################################################################################### 100.0%
Running install script.
python3 /tmp/oci_cli_install_tmp_WSY9 
/tmp/oci_cli_install_tmp_WSY9:524: SyntaxWarning: invalid escape sequence '\E'
  command = "powershell -Command \"[Environment]::SetEnvironmentVariable(\\\"PATH\\\", \\\"{};\\\" + (Get-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Environment' -Name PATH).Path, \\\"User\\\")".format(exec_dir)  # noqa: W605
-- Verifying Python version.
-- Python version 3.12.3 okay.

===> In what directory would you like to place the install? (leave blank to use '/home/ganu/lib/oracle-cli'): 
-- We will install at '/home/ganu/lib/oracle-cli'.

===> In what directory would you like to place the 'oci' executable? (leave blank to use '/home/ganu/bin'): 
-- The executable will be in '/home/ganu/bin'.

===> In what directory would you like to place the OCI scripts? (leave blank to use '/home/ganu/bin/oci-cli-scripts'): 
-- The scripts will be in '/home/ganu/bin/oci-cli-scripts'.

===> Currently supported optional packages are: ['db (will install cx_Oracle)']
What optional CLI packages would you like to be installed (comma separated names; press enter if you don't need any optional packages)?: 
-- The optional packages installed will be ''.
-- Executing: ['sudo', 'apt-get', 'update']
Hit:1 https://download.docker.com/linux/ubuntu noble InRelease
Hit:2 https://packages.microsoft.com/repos/code stable InRelease             
Hit:3 http://security.ubuntu.com/ubuntu noble-security InRelease             
Get:4 https://nvidia.github.io/libnvidia-container/stable/deb/amd64  InRelease [1,477 B]                 
Hit:5 http://archive.ubuntu.com/ubuntu noble InRelease                                                   
Fetched 1,477 B in 6s (255 B/s)
Reading package lists... Done
-- Installing python3-venv.
-- Executing: ['sudo', 'apt-get', 'install', 'python3-venv', '-y']
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-venv : Depends: python3 (= 3.12.3-0ubuntu1) but 3.12.3-0ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.
-- System was unable to use venv, is going to download and create virtualenv.
-- Downloading virtualenv package from https://github.com/pypa/get-virtualenv/blob/20.6.0/public/virtualenv.pyz?raw=true.
-- Downloaded virtualenv package to /tmp/tmpgep16p06/virtualenv-20.6.0.pyz.
-- Checksum of /tmp/tmpgep16p06/virtualenv-20.6.0.pyz OK.
-- Executing: ['/usr/bin/python3', 'virtualenv-20.6.0.pyz', '/home/ganu/lib/oracle-cli']
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/tmp/tmpgep16p06/virtualenv-20.6.0.pyz/__main__.py", line 168, in <module>
  File "/tmp/tmpgep16p06/virtualenv-20.6.0.pyz/__main__.py", line 164, in run
  File "/tmp/tmpgep16p06/virtualenv-20.6.0.pyz/virtualenv/__main__.py", line 18, in run
  File "/tmp/tmpgep16p06/virtualenv-20.6.0.pyz/virtualenv/run/__init__.py", line 32, in cli_run
  File "/tmp/tmpgep16p06/virtualenv-20.6.0.pyz/virtualenv/run/session.py", line 46, in run
  File "/tmp/tmpgep16p06/virtualenv-20.6.0.pyz/virtualenv/run/session.py", line 53, in _create
  File "/tmp/tmpgep16p06/virtualenv-20.6.0.pyz/virtualenv/create/creator.py", line 171, in run
  File "/tmp/tmpgep16p06/virtualenv-20.6.0.pyz/virtualenv/create/via_global_ref/builtin/via_global_self_do.py", line 79, in create
  File "/tmp/tmpgep16p06/virtualenv-20.6.0.pyz/virtualenv/create/via_global_ref/builtin/via_global_self_do.py", line 104, in ensure_directories
  File "/tmp/tmpgep16p06/virtualenv-20.6.0.pyz/virtualenv/create/describe.py", line 29, in bin_dir
  File "/tmp/tmpgep16p06/virtualenv-20.6.0.pyz/virtualenv/create/describe.py", line 33, in script_dir
  File "/tmp/tmpgep16p06/virtualenv-20.6.0.pyz/virtualenv/discovery/py_info.py", line 125, in install_path
ValueError: too many values to unpack (expected 2)
Traceback (most recent call last):
  File "/tmp/oci_cli_install_tmp_WSY9", line 257, in create_virtualenv
    install_python3_venv()
  File "/tmp/oci_cli_install_tmp_WSY9", line 211, in install_python3_venv
    exec_command(cmd)
  File "/tmp/oci_cli_install_tmp_WSY9", line 141, in exec_command
    subprocess.check_call(command_list, cwd=cwd, env=env)
  File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', 'apt-get', 'install', 'python3-venv', '-y']' returned non-zero exit status 100.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/oci_cli_install_tmp_WSY9", line 722, in <module>
    main()
  File "/tmp/oci_cli_install_tmp_WSY9", line 668, in main
    create_virtualenv(tmp_dir, install_dir)
  File "/tmp/oci_cli_install_tmp_WSY9", line 271, in create_virtualenv
    download_and_create_virtualenv(tmp_dir, install_dir)
  File "/tmp/oci_cli_install_tmp_WSY9", line 196, in download_and_create_virtualenv
    exec_command(cmd, cwd=working_dir)
  File "/tmp/oci_cli_install_tmp_WSY9", line 141, in exec_command
    subprocess.check_call(command_list, cwd=cwd, env=env)
  File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', 'virtualenv-20.6.0.pyz', '/home/ganu/lib/oracle-cli']' returned non-zero exit status 1.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with scripts/install/install.sh and the downloaded scripts/install/install.py, especially create_virtualenv, install_python3_venv, and download_and_create_virtualenv. Reproduce the installer on Ubuntu 24.04 with Python 3.12 and trace both the python3-venv dependency failure and the virtualenv fallback; done means the OCI CLI installs successfully in that environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.