During easy_install of an egg where two versions of pyparsing were available (1.5.2 and 1.5.6), a VersionConflict was raised:
pkg_resources.VersionConflict: (pyparsing 1.5.6 (/usr/lib/python2.7/dist-packages), Requirement.parse('pyparsing==1.5.2')) This was unexpected since sys.path (via virtualenv) has version 1.5.2 before 1.5.6. And the system gets 1.5.2 from 'import pyparsing', not 1.5.6. I've traced this to the line calling _sort_dists(dists), line 801 in my copy of pkg_resources.py: def __getitem__(self,project_name): """Return a newest-to-oldest list of distributions for `project_name` """ try: return self._cache[project_name] except KeyError: project_name = project_name.lower() if project_name not in self._distmap: return [] if project_name not in self._cache: dists = self._cache[project_name] = self._distmap[project_name] _sort_dists(dists) return self._cache[project_name] The problem is that one dependent package of the egg has a requirement of 'pyparsing' while a subsequent dependent package has a requirement of 'pyparsing==1.5.2'. The intent was that by using virtualenv with a correct sys.path version 1.5.2 would be used for both requirements. Unfortunately, because of the call to _sort_dists(), the 'pyparsing' requirement is resolved to 1.5.6 by env.best_match() in WorkingSet.resolve(). Once that resolution was made, the more explicit requirement fails. Note that without the _sort_dists() call the egg loads and runs correctly, using pyparsing 1.5.2. Its not clear to me that removing the _sort_dists() call is correct in general, but it appears to be a bug that an egg which would load and run correctly reports a VersionConflict.
_______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig