Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #4549: Ignore incompatibilities when resolve dist #4593

Merged
merged 4 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/4549.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug that ``importlib-metadata`` from the project's dependencies conflicts with that from ``pipenv``'s.
Empty file.
7 changes: 6 additions & 1 deletion pipenv/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ def resolve_dist(cls, dist, working_set):
except (KeyError, AttributeError, OSError, IOError): # The METADATA file can't be found
return deps
for req in reqs:
dist = working_set.find(req)
try:
dist = working_set.find(req)
except pkg_resources.VersionConflict:
# https://github.com/pypa/pipenv/issues/4549
# The requirement is already present with incompatible version.
continue
deps |= cls.resolve_dist(dist, working_set)
return deps

Expand Down
2 changes: 1 addition & 1 deletion pipenv/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

def find_site_path(pkg, site_dir=None):
import pkg_resources
if site_dir is not None:
if site_dir is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact the site_dir is always given the same value as os.path.dirname(os.path.dirname(os.path.abspath(__file__))), lol

site_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
working_set = pkg_resources.WorkingSet([site_dir] + sys.path[:])
for dist in working_set:
Expand Down