We been using python module argcomplete - 1.12.3 that required for module"yq".
The problem is we been using customized python [ that is for our environment pupose]
Ex;
python -- would point python 2.x
python3 -- would point to python 3.x
the problem is when we try to build and use the module argcomplete with python3 [python 3.8.1] we facing below issue
[root@linsee-automation-abinaya argcomplete-1.12.3-py3.7.egg-info]$ yq
Traceback (most recent call last):
File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 583, in _build_master
ws.require(requires)
File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 791, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (importlib-metadata 0.0.0 (/opt/python3-importlib-metadata/noarch/4.5.0.p375-1/lib/python3.7/site-packages), Requirement.parse('importlib-metadata<5,>=0.23'), {'argcomplete'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/python3-yq/noarch/2.12.0.p375-1/bin/yq", line 6, in
from pkg_resources import load_entry_point
File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 3250, in
@_call_aside
File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 3234, in _call_aside
f(*args, **kwargs)
File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 3263, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 585, in _build_master
return cls._build_from_requirements(requires)
File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 598, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'importlib-metadata<5,>=0.23' distribution was not found and is required by argcomplete
importlib_metadata already installed in our environment that pointed with PYTHONPATH env variable
on further investigation we understand that this is because of argcomplete/requires.txt is in below python specific format
Hi Team,
We been using python module argcomplete - 1.12.3 that required for module"yq".
The problem is we been using customized python [ that is for our environment pupose]
Ex;
python -- would point python 2.x python3 -- would point to python 3.x
the problem is when we try to build and use the module argcomplete with python3 [python 3.8.1] we facing below issue
[root@linsee-automation-abinaya argcomplete-1.12.3-py3.7.egg-info]$ yq Traceback (most recent call last): File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 583, in _build_master ws.require(requires) File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 900, in require needed = self.resolve(parse_requirements(requirements)) File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 791, in resolve raise VersionConflict(dist, req).with_context(dependent_req) pkg_resources.ContextualVersionConflict: (importlib-metadata 0.0.0 (/opt/python3-importlib-metadata/noarch/4.5.0.p375-1/lib/python3.7/site-packages), Requirement.parse('importlib-metadata<5,>=0.23'), {'argcomplete'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/python3-yq/noarch/2.12.0.p375-1/bin/yq", line 6, in from pkg_resources import load_entry_point File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 3250, in @_call_aside File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 3234, in _call_aside f(*args, **kwargs) File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 3263, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 585, in _build_master return cls._build_from_requirements(requires) File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 598, in _build_from_requirements dists = ws.resolve(reqs, Environment()) File "/opt/python3/x86_64/3.7.5/lib/python3.7/site-packages/pkg_resources/init.py", line 786, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'importlib-metadata<5,>=0.23' distribution was not found and is required by argcomplete
importlib_metadata already installed in our environment that pointed with PYTHONPATH env variable
on further investigation we understand that this is because of argcomplete/requires.txt is in below python specific format
[root@linsee-automation-abinaya argcomplete-1.12.3-py3.7.egg-info]$ cat requires.txt
[:python_version == "2.7"] importlib-metadata<5,>=0.23
[:python_version == "3.5"] importlib-metadata<5,>=0.23
[:python_version == "3.6"] importlib-metadata<5,>=0.23
[:python_version == "3.7"] importlib-metadata<5,>=0.23
Since our version of python is mentioned as python3.
when we manually changed to requires.txt to be [:python3_version == 3.7] and no issue.
So please let us know why there is version specific information for argcomplete, how can we avoid this further.
also we been using 500+ python modules in this same way and no issue so far.
issue only observed on argcomplete only.
would be great if anyone help/suggest here.
Thank you!!!