Skip to content

Move from pkg_resources to importlib.metadata - #125

Merged
mnlevy1981 merged 2 commits into
NCAR:mainfrom
mnlevy1981:drop_pkg_resources
Jun 3, 2026
Merged

mnlevy1981 merged 2 commits into
NCAR:mainfrom
mnlevy1981:drop_pkg_resources

Conversation

@mnlevy1981

Copy link
Copy Markdown
Contributor

pkg_resources was moved from setuptools in v82.0.0. The recommendation is to use importlib.metadata instead.

Fixes #122

Testing:

Using 4947c0c with python 3.13.12

>>> import ncar_jobqueue
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    import ncar_jobqueue
  File "/glade/work/mlevy/codes/CUPiD/externals/ncar-jobqueue/ncar_jobqueue/__init__.py", line 4, in <module>
    from pkg_resources import DistributionNotFound, get_distribution
ModuleNotFoundError: No module named 'pkg_resources'
>>>

This branch

>>> import ncar_jobqueue
>>>

note this is on Casper; on derecho we get a new error:

>>> import ncar_jobqueue
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    import ncar_jobqueue
  File "/glade/work/mlevy/codes/CUPiD/externals/ncar-jobqueue/ncar_jobqueue/__init__.py", line 6, in <module>
    from . import config
  File "/glade/work/mlevy/codes/CUPiD/externals/ncar-jobqueue/ncar_jobqueue/config.py", line 47, in <module>
    configure(destination_path)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/glade/work/mlevy/codes/CUPiD/externals/ncar-jobqueue/ncar_jobqueue/config.py", line 30, in configure
    original_data = yaml.safe_load(f)[host]
                    ~~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'derecho'
>>>

Really we just need NCAR users to switch to PBSCluster objects, this project hasn't been necessary since casper switched from SLURM to PBS to match cheyenne...

mnlevy1981 and others added 2 commits May 27, 2026 14:10
pkg_resources was moved from setuptools in v82.0.0. The recommendation is to
use importlib.metadata instead.
@mnlevy1981
mnlevy1981 merged commit bbc7053 into NCAR:main Jun 3, 2026
4 checks passed
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

Successfully merging this pull request may close these issues.

ncar-jobqueue still relies on deprecated "pkg_resources" package

1 participant