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

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

Closed
richardforth opened this issue Mar 29, 2022 · 6 comments

Comments

@richardforth
Copy link
Owner

[ !! ] 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
Copy link
Owner Author

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
Copy link
Owner Author

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
Copy link
Owner Author

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

@richardforth
Copy link
Owner Author

On Ubuntu

$ pip install distro
Requirement already satisfied: distro in /usr/lib/python3/dist-packages (1.4.0)

@richardforth
Copy link
Owner Author

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
Copy link
Owner Author

Closed, tests passing with deprecation warnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant