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:
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
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_resourcesfrom setuptools, whilePyBioNetGen still imports:
This causes a runtime
ModuleNotFoundError.Environment
Error
Running:
Produces:
Direct import also fails:
python -c "import pkg_resources"Root Cause
As of setuptools 81+,
pkg_resourceshas been removed.PyBioNetGen currently imports:
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:
With:
And add
packagingas a direct dependency inpyproject.tomlorsetup.py.This removes reliance on deprecated
pkg_resourcesand restorescompatibility with modern setuptools and Python 3.12+.
Impact
toolchains
Recommendation
pkg_resourcespackaging