Fix Python pkg_resources.VersionConflict error

When using setuptools entry_points or scripts like

  • scripts
  • entry_points: console_scripts

you may get errors like

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

This can come from when you’ve used one or the other of scripts or entry_points:console_scripts, and still have the old script in your Python bin directory. For Anaconda Python, the scripts and console_scripts are in a directory like ~/miniconda3/bin. In general, check in the directory coming from:

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

After finding the old scripts, delete them (be sure they’re your old scripts, not something else you might need).

Example fix

Suppose “setup.cfg” for package “mypkg” previously contained:

scripts =

and now the project is moving to the more robust entry_points technique like

console_scripts =
  myprog = mypkg.__main__:cli

Fix this error by deleting ~/miniconda3/bin/