py39-salt, missing contextvars dependency?

I upgraded my sysutils/py-salt package to version 3006.1_1 (currently running 13.1-RELEASE with "latest" pkg sources). When trying to run a state from a minion the call crashes with various error messages. The line I finally found is:
Code:
pkg_resources.DistributionNotFound: The 'contextvars' distribution was not found and is required by salt
The error appears on an upgraded version and on a fresh install of salt.
After running
Code:
pkg install py39-pip
pip install contextvars
# not nice, I know. But for debugging purposes
the states I called worked flawlessly again.

How can I help to improve this behavior? Thanks for your response ;)
 
That contextvars should be included with Python 3.8 and above.

Code:
dice@molly:~ % python3.9 -m contextvars
dice@molly:~ %
 
Hmm, interesting. I'm investigating further.

Using a freshly created jail I install sysutils/py-salt and try to salt-call state.apply a state from my salt master.
Code:
# "quarterly" pkg sources
root@testjail:~ # pkg info py39-salt
py39-salt-3005.1_2
Name           : py39-salt
Version        : 3005.1_2
Installed on   : Mon Jul  3 09:31:32 2023 UTC
Origin         : sysutils/py-salt

# works fine ;)
I then changed the pkg sources to "latest" and did a pkg upgrade -y which updates py39-salt to 3006.1_1.
Now calling the same state with the updated salt results in tons of errors... including the one I included above, see attached log file.
 

Attachments

  • minion-salt-call.error.txt
    21 KB · Views: 46
Sadly I upgrade today to 3006 and it's broken on my system as well..

Code:
[ERROR   ] Failed to import module seed, this is due most likely to a syntax error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/salt/loader/lazy.py", line 772, in _load_module
    mod = self.run(spec.loader.load_module)
  File "/usr/local/lib/python3.9/site-packages/salt/loader/lazy.py", line 1232, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/salt/loader/lazy.py", line 1247, 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/local/lib/python3.9/site-packages/salt/modules/seed.py", line 15, in <module>
    import salt.utils.cloud
  File "/usr/local/lib/python3.9/site-packages/salt/utils/cloud.py", line 82, in <module>
    import pkg_resources  # pylint: disable=3rd-party-module-not-gated
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3260, in <module>
    def _initialize_master_working_set():
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3234, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3272, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 581, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 909, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 795, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'contextvars' distribution was not found and is required by salt

I tried to pip installed contextvars , but it is still not working.

Code:
sharky@unbound ~ % pip list
Package       Version
------------- ---------
certifi       2021.10.8
cffi          1.15.0
chardet       4.0.0
contextvars   2.4


 
From the contextvar readme ....


Listing as a Dependency
=======================

The good news is that the standard library always takes the
precedence over site packages, so even if a local ``contextvars``
module is installed, the one from the standard library will be used.

Therefore you can simply list "contextvars" in your
``requirements.txt`` or ``setup.py`` files.

Another option is to use `"platform specific dependencies"
<http://setuptools.readthedocs.io/en/latest/setuptools.html\
#declaring-platform-specific-dependencies>`_ setuptools feature:

.. code-block:: python

import setuptools

setuptools.setup(
name="Project",
...
install_requires=[
'contextvars;python_version<"3.7"'
]
)


License
=======

Apache 2.0.
 
1. edit /usr/local/lib/python3.9/site-packages/salt-3006.2-py3.9.egg-info/requires.txt
2. Comment out contextvars there.
3. Solved.

For me anyway. I use the package so it may be different with the port.
 
Back
Top