Fix Python pkg_resources.VersionConflict error

less than 1 minute read

Related: Minimal setup.py/setup.cfg with console_scripts


When using setuptools.setup options 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

If I previously used:

  • myprog.py via setuptools.setup(scripts=)

and now use

  • myprog via setuptools.setup(entry_points=console_scripts=)

I would fix this error by deleting myprog.py under ~/miniconda3/bin.

Categories:

Updated:

Leave a comment