Skip to content

Curl to bash install fails without root if not using Python 3.6 or 3.7 #424

@bede

Description

@bede

Hi there,
Curl to bash install does not appear to be tested without root. Presence of F-strings necessitates Python >=3.6. However, platform.linux_distribution on which the installer depends is deprecated in Python 3.8, meaning that only 3.6 and 3.7 are supported, causing the installer to crash.

I managed to install the client trivially in the end by creating a Python 3.7 env and pip installing the PyPI package. I used conda but any equivalent approach should work fine. The installer appears broken without root, and perhaps this workaround could be documented.

conda create -n oci python=3.7
conda activate oci
pip install oci-cli
oci setup config

Ubuntu 20.04.2, Python 3.8.5

bede@mmm-slurm20h:~$ 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 17509  100 17509    0     0  77473      0 --:--:-- --:--:-- --:--:-- 77473

    ******************************************************************************
    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/v2.22.0/scripts/install/install.py to /tmp/oci_cli_install_tmp_vffb.
####################################################################################################################################################################################################### 100.0%
Python not found on system PATH
Running install script.
python3 /tmp/oci_cli_install_tmp_vffb 
-- Verifying Python version.
-- Python version 3.8.5 okay.

===> In what directory would you like to place the install? (leave blank to use '/home/ndm.local/bede/lib/oracle-cli'): 
-- Creating directory '/mnt/microbio/HOMES/bede/lib/oracle-cli'.
-- We will install at '/mnt/microbio/HOMES/bede/lib/oracle-cli'.

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

===> In what directory would you like to place the OCI scripts? (leave blank to use '/home/ndm.local/bede/bin/oci-cli-scripts'): 
-- Creating directory '/mnt/microbio/HOMES/bede/bin/oci-cli-scripts'.
-- The scripts will be in '/mnt/microbio/HOMES/bede/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']
[sudo] password for bede: 

Sorry, try again.
[sudo] password for bede: 

Sorry, try again.
[sudo] password for bede: 

sudo: 3 incorrect password attempts
-- System was unable to use venv, is going to download and create virtualenv.
-- Downloading virtualenv package from https://github.com/pypa/virtualenv/archive/15.0.0.tar.gz.
-- Downloaded virtualenv package to /tmp/tmpqbdu3qnz/15.0.0.tar.gz.
-- Checksum of /tmp/tmpqbdu3qnz/15.0.0.tar.gz OK.
-- Extracting '/tmp/tmpqbdu3qnz/15.0.0.tar.gz' to '/tmp/tmpqbdu3qnz'.
-- Executing: ['/usr/bin/python3', 'virtualenv.py', '--python', '/usr/bin/python3', '/mnt/microbio/HOMES/bede/lib/oracle-cli']
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
virtualenv.py:1030: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
New python executable in /mnt/microbio/HOMES/bede/lib/oracle-cli/bin/python3
Also creating executable in /mnt/microbio/HOMES/bede/lib/oracle-cli/bin/python
Installing setuptools, pip, wheel...
  Complete output from command /mnt/microbio/HOMES/...acle-cli/bin/python3 - setuptools pip wheel:
  Exception:
Traceback (most recent call last):
  File "/tmp/tmpqbdu3qnz/virtualenv-15.0.0/virtualenv_support/pip-8.1.0-py2.py3-none-any.whl/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/tmp/tmpqbdu3qnz/virtualenv-15.0.0/virtualenv_support/pip-8.1.0-py2.py3-none-any.whl/pip/commands/install.py", line 249, in run
    with self._build_session(options) as session:
  File "/tmp/tmpqbdu3qnz/virtualenv-15.0.0/virtualenv_support/pip-8.1.0-py2.py3-none-any.whl/pip/basecommand.py", line 66, in _build_session
    session = PipSession(
  File "/tmp/tmpqbdu3qnz/virtualenv-15.0.0/virtualenv_support/pip-8.1.0-py2.py3-none-any.whl/pip/download.py", line 321, in __init__
    self.headers["User-Agent"] = user_agent()
  File "/tmp/tmpqbdu3qnz/virtualenv-15.0.0/virtualenv_support/pip-8.1.0-py2.py3-none-any.whl/pip/download.py", line 93, in user_agent
    zip(["name", "version", "id"], platform.linux_distribution()),
AttributeError: module 'platform' has no attribute 'linux_distribution'
Traceback (most recent call last):
  File "<stdin>", line 23, in <module>
  File "/tmp/tmpqbdu3qnz/virtualenv-15.0.0/virtualenv_support/pip-8.1.0-py2.py3-none-any.whl/pip/__init__.py", line 213, in main
  File "/tmp/tmpqbdu3qnz/virtualenv-15.0.0/virtualenv_support/pip-8.1.0-py2.py3-none-any.whl/pip/basecommand.py", line 242, in main
  File "/tmp/tmpqbdu3qnz/virtualenv-15.0.0/virtualenv_support/pip-8.1.0-py2.py3-none-any.whl/pip/basecommand.py", line 66, in _build_session
  File "/tmp/tmpqbdu3qnz/virtualenv-15.0.0/virtualenv_support/pip-8.1.0-py2.py3-none-any.whl/pip/download.py", line 321, in __init__
  File "/tmp/tmpqbdu3qnz/virtualenv-15.0.0/virtualenv_support/pip-8.1.0-py2.py3-none-any.whl/pip/download.py", line 93, in user_agent
AttributeError: module 'platform' has no attribute 'linux_distribution'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "virtualenv.py", line 2311, in <module>
    main()
  File "virtualenv.py", line 693, in main
    create_environment(home_dir,
  File "virtualenv.py", line 932, in create_environment
    install_wheel(
  File "virtualenv.py", line 892, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "virtualenv.py", line 785, in call_subprocess
    raise OSError(
OSError: Command /mnt/microbio/HOMES/...acle-cli/bin/python3 - setuptools pip wheel failed with error code 1
Traceback (most recent call last):
  File "/tmp/oci_cli_install_tmp_vffb", line 246, in create_virtualenv
    install_python3_venv()
  File "/tmp/oci_cli_install_tmp_vffb", line 208, in install_python3_venv
    exec_command(cmd)
  File "/tmp/oci_cli_install_tmp_vffb", line 139, in exec_command
    subprocess.check_call(command_list, cwd=cwd, env=env)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', 'apt-get', 'update']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/oci_cli_install_tmp_vffb", line 710, in <module>
    main()
  File "/tmp/oci_cli_install_tmp_vffb", line 656, in main
    create_virtualenv(tmp_dir, install_dir)
  File "/tmp/oci_cli_install_tmp_vffb", line 259, in create_virtualenv
    download_and_create_virtualenv(tmp_dir, install_dir)
  File "/tmp/oci_cli_install_tmp_vffb", line 200, in download_and_create_virtualenv
    exec_command(cmd, cwd=working_dir)
  File "/tmp/oci_cli_install_tmp_vffb", line 139, in exec_command
    subprocess.check_call(command_list, cwd=cwd, env=env)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', 'virtualenv.py', '--python', '/usr/bin/python3', '/mnt/microbio/HOMES/bede/lib/oracle-cli']' returned non-zero exit status 1.
bede@mmm-slurm20h:~$ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    SDKIssue pertains to the SDK itself and not specific to any service

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions