[Pkg-salt-team] Bug#999590: pkg_resources.DistributionNotFound: The 'contextvars' distribution was not found and is required by salt
David Mandelberg
david at mandelberg.org
Mon Nov 15 18:25:18 GMT 2021
Op 15-11-2021 om 10:41 schreef Benjamin Drung:> I cannot reproduce this
issue on unstable, since Python 3.9 provides
> the contextvars module. What setup do you have and what Python version?
I'm on Debian testing, also with Python 3.9 (see version report below).
If I understand the issue correctly, it doesn't matter that contextvars
is available in the standard library, what's happening is that
pkg_resources (not the import statement) can't find contextvars. E.g.,
https://github.com/openbsd/ports/commit/77ea7ea5dec0623f9a1ad27334f9beb541c90478
and
https://github.com/void-linux/void-packages/pull/33331/commits/41f280427ced6bc986ca861852d9d6435f05cb1c
seem to just remove the requirement for the contextvars package, rather
than adding a dependency on it.
Would you mind running this command? I wonder if you installed
contextvars from pip or something a while ago?
$ python3 -c 'import pkg_resources;
print(pkg_resources.require("contextvars"))'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
886, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
772, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'contextvars' distribution was
not found and is required by the application
$ salt-call --versions-report
Salt Version:
Salt: 3004
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.0.1
libgit2: 1.1.0
M2Crypto: Not Installed
Mako: 1.1.3
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.9.7
pygit2: 1.4.0
Python: 3.9.8 (main, Nov 7 2021, 15:47:09)
python-gnupg: Not Installed
PyYAML: 5.4.1
PyZMQ: 22.3.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: debian testing bookworm
locale: utf-8
machine: x86_64
release: 5.14.0-2-amd64
system: Linux
version: Debian GNU/Linux testing bookworm
$ sudo salt-call state.apply
[ERROR ] Failed to import module pip, this is due most likely to a
syntax error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 766,
in _load_module
mod = self.run(spec.loader.load_module)
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1201,
in run
return self._last_context.run(self._run_as, _func_or_method, *args,
**kwargs)
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1216,
in _run_as
return _func_or_method(*args, **kwargs)
File "<frozen importlib._bootstrap_external>", line 529, in
_check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 1029, in load_module
File "<frozen importlib._bootstrap_external>", line 854, in load_module
File "<frozen importlib._bootstrap>", line 274, in _load_module_shim
File "<frozen importlib._bootstrap>", line 711, in _load
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in
_call_with_frames_removed
File "/usr/lib/python3/dist-packages/salt/modules/pip.py", line 87,
in <module>
import pkg_resources # pylint: disable=3rd-party-module-not-gated
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
3243, in <module>
def _initialize_master_working_set():
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
3226, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
3255, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
568, in _build_master
ws.require(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
886, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
772, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'contextvars' distribution was
not found and is required by salt
[ERROR ] Failed to import states pip_state, this is due most likely to
a syntax error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 766,
in _load_module
mod = self.run(spec.loader.load_module)
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1201,
in run
return self._last_context.run(self._run_as, _func_or_method, *args,
**kwargs)
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1216,
in _run_as
return _func_or_method(*args, **kwargs)
File "<frozen importlib._bootstrap_external>", line 529, in
_check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 1029, in load_module
File "<frozen importlib._bootstrap_external>", line 854, in load_module
File "<frozen importlib._bootstrap>", line 274, in _load_module_shim
File "<frozen importlib._bootstrap>", line 711, in _load
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in
_call_with_frames_removed
File "/usr/lib/python3/dist-packages/salt/states/pip_state.py", line
32, in <module>
import pkg_resources
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
3243, in <module>
def _initialize_master_working_set():
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
3226, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
3255, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
568, in _build_master
ws.require(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
886, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
772, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'contextvars' distribution was
not found and is required by salt
local:
Summary for local
-------------
Succeeded: 73
Failed: 0
-------------
Total states run: 73
Total run time: 718.382 ms
More information about the pkg-salt-team
mailing list