Python pkg_resources.VersionConflict

When using Python project scripts, if one get:

pkg_resources.VersionConflict: (mypkg 1.1.2 (~/mypkg), Requirement.parse(‘mypkg==1.1.0’))

This can come from an old script in Python bin directory, e.g. ~/miniconda3/bin. Check in the directory coming from:

python -c "import sys; print(sys.executable)"

After finding the old scripts, delete them (be sure they’re not something needed).

Example: suppose package “mypkg” previously contained myprog.py and now the project is moving to the more robust entry_points technique like

[project.scripts]
myprog = mypkg.__main__:cli

Fix by deleting ~/miniconda3/bin/myprog.py.