Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible-navigator 24.3.2 attempts to load python 3.9 library instead of 3.12 when inspecting EE images #1766

Open
jasondickerson opened this issue May 16, 2024 · 3 comments
Labels
bug Researched, reproducible, committed to fix

Comments

@jasondickerson
Copy link

jasondickerson commented May 16, 2024

ISSUE TYPE
  • Bug Report
SUMMARY

Encountering issue using ansible-navigator to display the Ansible collections within an execution environment:

ImportError: cannot import name 'TypeAlias' from 'typing' (/usr/lib64/python3.9/typing.py)

The environment is Fedora 40, ansible-navigator 24.3.2.

Workaround: downgrade to ansible-navigator 24.2.0.

ANSIBLE-NAVIGATOR VERSION
ansible-navigator 24.3.2
CONFIGURATION
---
ansible-navigator:
  execution-environment:
    pull:
      policy: missing
  playbook-artifact:
    enable: false
  logging:
    file: ~/ansible-navigator.log
...
LOG FILE
2024-05-16T21:18:03.410409+00:00 ERROR 'ansible_navigator.actions.images._parse' Unable to extract introspection from stdout
2024-05-16T21:18:03.412977+00:00 ERROR 'ansible_navigator.actions.images._parse' Image introspection failed (parsed), the return value was: Traceback (most recent call last):
  File "/home/jdickerson/.cache/ansible-navigator/image_introspect.py", line 16, in <module>
    from typing import TypeAlias
ImportError: cannot import name 'TypeAlias' from 'typing' (/usr/lib64/python3.9/typing.py)
STEPS TO REPRODUCE

OS: Fedora 40

  1. "# python3 -m pip install ansible-navigator --user"
  2. use podman pull to download any execution environment image
  3. run "# ansible-navigator images"
  4. select an execution environment image
  5. Select Option 2 in order to inspect the Ansible collections.
  6. Receive error
  7. Escape back to the shell and review your ansible-navigator.log file
EXPECTED RESULTS

I expect to see the list of Ansible collections with their versions.

ACTUAL RESULTS

I receive an error message that something went really wrong, and find the following in the ansible-navigator.log

2024-05-16T21:18:03.410409+00:00 ERROR 'ansible_navigator.actions.images._parse' Unable to extract introspection from stdout
2024-05-16T21:18:03.412977+00:00 ERROR 'ansible_navigator.actions.images._parse' Image introspection failed (parsed), the return value was: Traceback (most recent call last):
  File "/home/jdickerson/.cache/ansible-navigator/image_introspect.py", line 16, in <module>
    from typing import TypeAlias
ImportError: cannot import name 'TypeAlias' from 'typing' (/usr/lib64/python3.9/typing.py)
ADDITIONAL INFORMATION

Only workaround is to downgrade to ansible-navigator 24.2.0

@jasondickerson jasondickerson added bug Researched, reproducible, committed to fix new New issues and PRs to triaged labels May 16, 2024
@ssbarnea ssbarnea removed the new New issues and PRs to triaged label May 22, 2024
@ssbarnea
Copy link
Member

Please remove the cache first and also provide more information about which python interpreter is used to execute navigator.

@cidrblock
Copy link
Collaborator

This is a good find. Can you confirm the python version inside the EE? The image_introspect.py is volume mounted into the EE and run there to introspect it.

@jasondickerson
Copy link
Author

jasondickerson commented May 22, 2024

I cleared the ansible-navigatgor cache using "# rm ~/.cache/ansible-navigator/*" and tried again. I received the same result.

On Fedora 40 I am using the default python 3.12.

I have several EE's I can inspect:

quay.io/ansible/awx-ee:latest (inspection fails) (python 3.9)
ghcr.io/ansible/creator-ee:v24.2.0 (works) (python 3.12)
registry.redhat.io/ansible-automation-platform-24/ee-29-rhel8:latest (inspection fails) (python 3.8)
registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel8:latest (inspection fails) (python 3.9)
registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel8:latest (inspection fails) (python 3.9)

So it seems to depend on what python is in the EE. if the EE contains python 3.12 it works, 3.8 and 3.9 do not. Notice the OS I'm running on runs 3.12 as well.

If I downgrade to ansible-navigator==24.2.0 inspection works for all of the EE's regardless of the python version.

Python information by EE:

awx-ee:

bash-5.1$ python --version
Python 3.9.18
bash-5.1$ ls -l /usr/bin/python*
lrwxrwxrwx. 1 root root     9 Jan 26 18:40 /usr/bin/python -> ./python3
lrwxrwxrwx. 1 root root     9 Jan 26 18:30 /usr/bin/python3 -> python3.9
-rwxr-xr-x. 1 root root 15624 Jan 26 18:30 /usr/bin/python3.9
bash-5.1$ 

creator-ee:

root@creator-ee:v24.2.0: /tmp 
# python --version
Python 3.12.1
root@creator-ee:v24.2.0: /tmp 
# ls -l /usr/bin/python*
lrwxrwxrwx. 1 root root     9 Dec 18 00:00 /usr/bin/python -> ./python3
lrwxrwxrwx. 1 root root    16 Dec 18 00:00 /usr/bin/python-config -> ./python3-config
lrwxrwxrwx. 1 root root    10 Dec 18 00:00 /usr/bin/python3 -> python3.12
lrwxrwxrwx. 1 root root    17 Dec 18 00:00 /usr/bin/python3-config -> python3.12-config
-rwxr-xr-x. 1 root root 15888 Dec 18 00:00 /usr/bin/python3.12
-rwxr-xr-x. 1 root root    62 Dec 18 00:00 /usr/bin/python3.12-config
-rwxr-xr-x. 1 root root  3079 Dec 18 00:00 /usr/bin/python3.12-x86_64-config
root@creator-ee:v24.2.0: /tmp 
# 

ee-29-rhel8:

bash-4.4# python --version 
Python 3.8.17
bash-4.4# ls -al /usr/bin/python* 
lrwxrwxrwx. 1 root root   36 Apr 18  2023 /usr/bin/python -> /etc/alternatives/unversioned-python
lrwxrwxrwx. 1 root root   25 Apr 18  2023 /usr/bin/python3 -> /etc/alternatives/python3
-rwxr-xr-x. 1 root root 7776 Aug 10  2023 /usr/bin/python3.8
bash-4.4# 

ee-minimal-rhel8:

bash-4.4# python --version
Python 3.9.18
bash-4.4# ls -al /usr/bin/python*
lrwxrwxrwx. 1 root root   36 Apr 18 17:04 /usr/bin/python -> /etc/alternatives/unversioned-python
lrwxrwxrwx. 1 root root   25 Apr 18 17:04 /usr/bin/python3 -> /etc/alternatives/python3
-rwxr-xr-x. 1 root root 7768 Sep 22  2023 /usr/bin/python3.9
bash-4.4# 

ee-supported-rhel8:

bash-4.4# python --version
Python 3.9.18
bash-4.4# ls -al /usr/bin/python*
lrwxrwxrwx. 1 root root   36 Apr 18 17:04 /usr/bin/python -> /etc/alternatives/unversioned-python
lrwxrwxrwx. 1 root root   25 Apr 18 17:04 /usr/bin/python3 -> /etc/alternatives/python3
-rwxr-xr-x. 1 root root 7768 Sep 22  2023 /usr/bin/python3.9
bash-4.4# 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Researched, reproducible, committed to fix
Projects
Status: No status
Development

No branches or pull requests

3 participants