richardforth / apache2buddy

apache2buddy
Apache License 2.0
385 stars 72 forks source link

AmazonLinux [ !! ] Python scripting failed. Python requires package 'distro' or 'platform' to determine the Operating System and Version. #392

Closed richardforth closed 2 years ago

richardforth commented 2 years ago

[ !! ] Python scripting failed. Python requires package 'distro' or 'platform' to determine the Operating System and Version.

--

bash-4.2# python3 Python 3.7.10 (default, Jun 3 2021, 00:02:01) [GCC 7.3.1 20180712 (Red Hat 7.3.1-13)] on linux Type "help", "copyright", "credits" or "license" for more information.

import distro Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'distro' import platform platform.linux_distribution() main:1: DeprecationWarning: dist() and linux_distribution() functions are deprecated in Python 3.5 ('', '', '') platform. platform.DEV_NULL platform.machine( platform.python_compiler( platform.sys platform.architecture( platform.node( platform.python_implementation( platform.system( platform.collections platform.os platform.python_revision( platform.system_alias( platform.dist( platform.platform( platform.python_version( platform.uname( platform.java_ver( platform.popen( platform.python_version_tuple( platform.uname_result( platform.libc_ver( platform.processor( platform.re platform.version( platform.linux_distribution( platform.python_branch( platform.release( platform.warnings platform.mac_ver( platform.python_build( platform.subprocess platform.win32_ver( platform.release() '3.10.0-1160.59.1.el7.x86_64' platform.os <module 'os' from '/usr/lib64/python3.7/os.py'> platform.platform() 'Linux-3.10.0-1160.59.1.el7.x86_64-x86_64-with-glibc2.2.5' quit() bash-4.2# yum search python3-distro Loaded plugins: ovl, priorities Warning: No matches found for: python3-distro No matches found bash-4.2#

richardforth commented 2 years ago

upgraded to python 3.8 on amazon liinux but the distro package is still missing

its there on Ubuntu 20.04

$ python3
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import distro
>>> distro.linux_distribution()
('Ubuntu', '20.04', 'focal')
>>>
richardforth commented 2 years ago

https://distro.readthedocs.io/en/latest/

Lists "Amazon" as AmazonLinux

Yet the python-distro package is not available, and its not built in, I could try pip next?

richardforth commented 2 years ago

Well at least on ubuntu, pip knows about distro, so it might be an option.

richardforth commented 2 years ago

On Ubuntu

$ pip install distro
Requirement already satisfied: distro in /usr/lib/python3/dist-packages (1.4.0)
richardforth commented 2 years ago

pip3 install distro

... Collecting distro Downloading distro-1.7.0-py3-none-any.whl (20 kB) Installing collected packages: distro Successfully installed distro-1.7.0

richardforth commented 2 years ago

Closed, tests passing with deprecation warnings