dell / dell/ansible-unity

[BUG]: All modules fail with "Failed to import the required Python library (pkg_resources)" on setuptools >= 82

Open Beginner friendly
#69 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
30
Forks
26
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

`plugins/module_utils/storage/dell/utils.py` imports `pkg_resources` to read and compare the installed `storops` version:

```python
from pkg_resources import parse_version
import pkg_resources
...
curr_version = pkg_resources.require("storops")[0].version
```

`pkg_resources` was removed from setuptools in **82.0.0** (setuptools changelog: "pkg_resources has been removed from Setuptools", pypa/setuptools#3085). On any environment with a current setuptools every `dellemc.unity` module fails in `ensure_required_libs()`:

```
fatal: [jb3-unity-01 -> localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (pkg_resources) on 's Python /.../.venv/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
```

There is no standalone `pkg_resources` package on PyPI, so the only workaround today is pinning `setuptools<82`.

**To Reproduce**

1. `pip install "setuptools>=82" storops ansible-core`
2. `ansible-galaxy collection install dellemc.unity`
3. Run any module, e.g.:

```yaml
- dellemc.unity.info:
unispherehost: "{{ unispherehost }}"
username: "{{ username }}"
password: "{{ password }}"
validate_certs: false
gather_subset:
- ethernet_port
```

**Expected behavior**

Module runs. The storops version check should use `importlib.metadata` (stdlib since Python 3.8) instead of `pkg_resources`, as `dellemc.powerstore` already does with `ansible.module_utils.compat.version.LooseVersion`.

**Environment**

- dellemc.unity 2.1.0 (same code on `main`)
- ansible-core 2.21.4
- Python 3.14.6
- setuptools 84.0.0
- storops 1.2.12

Fix in PR to follow.

Contributor guide

Open the contributing guide

Research direction

Start with plugins/module_utils/storage/dell/utils.py, especially its pkg_resources imports and ensure_required_libs() version check, then reproduce with setuptools>=82, storops, and ansible-core. Done means the storops version check no longer depends on pkg_resources and a dellemc.unity module runs successfully in that environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible, python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.