python venv never created
xdkreij opened this issue · comments
On RHEL 8.6
Error
TASK [trinity/config-manager : Install config_manager pip package] **************************************************************************************************************
fatal: [d-vcpu-srv-01]: FAILED! => {"changed": false, "msg": "Failed to find required executable \"virtualenv\" in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin"}
file - roles/trinity/config-manager/tasks/main.yml
- name: Install luna2 packages
yum:
name: '{{ luna2_packages }}'
state: present
enablerepo: luna2
# Install config_manager pip package inside the Luna2 virtualenv
- name: Install config_manager pip package
ansible.builtin.pip:
name: '{{config_manager_noarch_pip_repository}}/config-manager/{{ config_manager_wheel }}'
virtualenv: '{{ trix_local }}/python'
extra_args: "--upgrade"
# Symlink '{{ trix_local }}/python/bin/trix-config-manager' to '{{ trix_local }}/sbin/trix-config-manager'
group_vars/all.yml
trix_images: '/trinity_images'
trix_shared: '/trinity_shared'
trix_local: '/trinity_local'
trix_luna: '{{ trix_local }}/luna'
trix_etc: '{{ trix_local }}/etc'
trix_sbin: '{{ trix_local }}/sbin'
trix_ood: '{{ trix_local }}/ondemand'
trix_ssl: '{{ trix_etc }}/ssl'
trix_home: '/trinity_home'
trix_repos: '{{ trix_root }}/repos'
trix_ohpc: '{{ trix_root }}/ohpc'
trix_licenses: '{{ trix_shared }}/licenses'
trix_docs: '{{ trix_shared }}/docs'
trix_examples: '{{ trix_shared }}/examples'
trix_modulefiles: '{{ trix_shared }}/modulefiles'
ls /trinity_local/
ls -alh /trinity_local/
total 4.0K
drwxrwxrwx. 7 root root 68 Dec 15 11:40 .
dr-xr-xr-x. 22 root root 4.0K Dec 15 11:35 ..
drwxrwxr-x. 5 ansible ansible 50 Dec 15 13:43 etc
drwxrwxr-x. 2 ansible ansible 6 Dec 15 11:02 luna
drwxrwxr-x. 2 ansible ansible 6 Dec 15 11:02 ondemand
drwxrwxr-x. 2 ansible ansible 6 Dec 15 11:02 sbin
drwxr-xr-x. 4 root named 30 Dec 15 13:56 var
*** where's the venv? there it is!!***
ls -alh /trinity/local/python/
total 20K
drwxr-xr-x. 6 root root 74 Dec 15 23:04 .
drwxr-xr-x. 3 root root 20 Dec 15 23:04 ..
drwxr-xr-x. 2 root root 4.0K Dec 15 23:04 bin
drwxr-xr-x. 3 root root 24 Dec 15 23:04 include
drwxr-xr-x. 4 root root 64 Dec 15 23:04 lib
-rw-r--r--. 1 root root 13K Aug 30 10:35 pyodbc.pyi
drwxr-xr-x. 3 root root 17 Dec 15 23:04 share
Another statically defined path is most likely the root cause
Expected results
- roles/trinity/config-manager/tasks/main.yml to make sure a VENV actually exists and if not, create one first
Thanks for reporting, we'll have a look into this. Internal ticket TRIX-389
Indeed, the changed path is not (yet) anticipated for.
The full traceback is:
File "/tmp/ansible_ansible.builtin.pip_payload_gd_n4f6i/ansible_ansible.builtin.pip_payload.zip/ansible/module_utils/basic.py", line 1443, in get_bin_path
bin_path = get_bin_path(arg=arg, opt_dirs=opt_dirs)
File "/tmp/ansible_ansible.builtin.pip_payload_gd_n4f6i/ansible_ansible.builtin.pip_payload.zip/ansible/module_utils/common/process.py", line 44, in get_bin_path
raise ValueError('Failed to find required executable "%s" in paths: %s' % (arg, os.pathsep.join(paths)))
fatal: [d-vcpu-srv-01]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"chdir": null,
"editable": false,
"executable": null,
"extra_args": "--upgrade",
"name": [
"https://updates.clustervision.com/trinityx/14/additional/noarch/pip/stable/config-manager/trinityx_config_manager-2.0.latest-py3-none-any.whl"
],
"requirements": null,
"state": "present",
"umask": null,
"version": null,
"virtualenv": "/trinity/local/python",
"virtualenv_command": "virtualenv",
"virtualenv_python": null,
"virtualenv_site_packages": false
}
},
"msg": "Failed to find required executable \"virtualenv\" in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin"
}
It still breaks, even when the path is correct
Simply because the python package 'python3-virtualenv.noarch' isn't being installed
Task completes fine after manual installation. Adding the package as a prerequisite should solve that
TASK [trinity/config-manager : Install config_manager pip package] **************************************************************************************************************
changed: [d-vcpu-srv-01] => {"changed": true, "cmd": ["/trinity/local/python/bin/pip3", "install", "--upgrade", "https://updates.clustervision.com/trinityx/14/additional/noarch/pip/stable/config-manager/trinityx_config_manager-2.0.latest-py3-none-any.whl"], "name": ["https://updates.clustervision.com/trinityx/14/additional/noarch/pip/stable/config-manager/trinityx_config_manager-2.0.latest-py3-none-any.whl"], "requirements": null, "state": "present", "stderr": "WARNING: You are using pip version 21.3.1; however, version 23.3.2 is available.\nYou should consider upgrading via the '/trinity/local/python/bin/platform-python -m pip install --upgrade pip' command.\n", "stderr_lines": ["WARNING: You are using pip version 21.3.1; however, version 23.3.2 is available.", "You should consider upgrading via the '/trinity/local/python/bin/platform-python -m pip install --upgrade pip' command."], "stdout": "Using base prefix '/usr'\nNew python executable in /trinity/local/python/bin/platform-python\nAlso creating executable in /trinity/local/python/bin/python\nInstalling setuptools, pip, wheel...done.\nRunning virtualenv with interpreter /usr/libexec/platform-python\nCollecting trinityx-config-manager==2.0.latest\n Using cached https://updates.clustervision.com/trinityx/14/additional/noarch/pip/stable/config-manager/trinityx_config_manager-2.0.latest-py3-none-any.whl (1.8 kB)\nInstalling collected packages: trinityx-config-manager\nSuccessfully installed trinityx-config-manager-2.0.1700240422\n", "stdout_lines": ["Using base prefix '/usr'", "New python executable in /trinity/local/python/bin/platform-python", "Also creating executable in /trinity/local/python/bin/python", "Installing setuptools, pip, wheel...done.", "Running virtualenv with interpreter /usr/libexec/platform-python", "Collecting trinityx-config-manager==2.0.latest", " Using cached https://updates.clustervision.com/trinityx/14/additional/noarch/pip/stable/config-manager/trinityx_config_manager-2.0.latest-py3-none-any.whl (1.8 kB)", "Installing collected packages: trinityx-config-manager", "Successfully installed trinityx-config-manager-2.0.1700240422"], "version": null, "virtualenv": "/trinity/local/python"}
TASK [trinity/config-manager : Symlink '/trinity/local/python/bin/trix-config-manager' to '/trinity/local/sbin/trix-config-manager'] ********************************************
changed: [d-vcpu-srv-01] => {"changed": true, "dest": "/trinity/local/sbin/trix-config-manager", "gid": 0, "group": "root", "mode": "0777", "owner": "root", "secontext": "unconfined_u:object_r:unlabeled_t:s0", "size": 45, "src": "/trinity/local/python/bin/trix-config-manager", "state": "link", "uid": 0}