Skip to content

PyBioNetGen fails with setuptools ≥81 (Python 3.12) #61

@wshlavacek

Description

@wshlavacek

Summary

PyBioNetGen 0.8.3 fails to run when installed in an environment with
modern setuptools (≥81).
The failure is due to removal of pkg_resources from setuptools, while
PyBioNetGen still imports:

from pkg_resources import packaging

This causes a runtime ModuleNotFoundError.


Environment

  • macOS (Darwin)
  • Python 3.12
  • PyBioNetGen 0.8.3
  • setuptools 82.0.1
  • Installed in a clean virtual environment

Error

Running:

bionetgen --version

Produces:

Traceback (most recent call last):
  File ".../.venv/bin/bionetgen", line 4, in <module>
    from bionetgen.main import main
  File ".../site-packages/bionetgen/main.py", line 21, in <module>
    from pkg_resources import packaging
ModuleNotFoundError: No module named 'pkg_resources'

Direct import also fails:

python -c "import pkg_resources"
ModuleNotFoundError: No module named 'pkg_resources'

Root Cause

As of setuptools 81+, pkg_resources has been removed.

PyBioNetGen currently imports:

from pkg_resources import packaging

This dependency no longer works with modern Python packaging stacks.


Temporary Workaround

Downgrade setuptools:

pip install "setuptools<81"

After downgrading, PyBioNetGen runs normally.


Proposed Fix

Replace usage of:

from pkg_resources import packaging

With:

from packaging import version

And add packaging as a direct dependency in pyproject.toml or
setup.py.

This removes reliance on deprecated pkg_resources and restores
compatibility with modern setuptools and Python 3.12+.


Impact

  • Breaks fresh Python 3.12 installations
  • Breaks modern virtual environments
  • Affects users using uv, pip, conda, or other modern packaging
    toolchains

Recommendation

  • Remove dependency on pkg_resources
  • Depend directly on packaging
  • Add CI testing against Python 3.12 and latest setuptools

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions