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

reference using setuptools instead of pip internal #116

Closed

Conversation

tejaschumbalkar
Copy link

Issue: #113

Reference function using setuptools instead of pip internal function. Reference: pypa/pip#5243

@raimon49
Copy link
Owner

Thanks for the information.

There is a part in the test code that mocks get_installed_distributions(). It needs to be fixed before merging.

user_only=False,
)
return [dist._dist for dist in dists]
import pkg_resources
Copy link
Owner

Choose a reason for hiding this comment

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

I understood that it is better not to import functions from pip._internal. However, this ported code seems to have the advantage of working in many user environments.

Will import pkg_resources succeed in all user environments? For example, it seems to exist in pip._vendor.pkg_resources.

@jpmn
Copy link

jpmn commented Nov 9, 2021

Any hope in seeing a fix for this issue merged in? Using pip=21.3.1, it throws an exception:

File ".venv\Scripts\pip-licenses.exe\__main__.py", line 4, in <module>
File ".venv\lib\site-packages\piplicenses.py", line 44, in <module>
  from pip import get_installed_distributions
ImportError: cannot import name 'get_installed_distributions' from 'pip' (.venv\lib\site-packages\pip\__init__.py)

@raimon49
Copy link
Owner

@jpmn I haven't decided if I want to merge this PR or not.

Please install the latest version of pip-licenses in your environment and see if it solves the error.

# Update pip-licenses version to 3.5.3 or later
$ pip install -U pip-licenses

@jpmn
Copy link

jpmn commented Nov 30, 2021

I am using the latest version of pip-licenses, but I had to freeze my pip version until there is a fix. I might consider dropping the library in the medium-term if it is blocking my upgrade of pip.

Don't you experience the same behavior with more recent versions of pip?

@worroc
Copy link

worroc commented Aug 28, 2022

This fix is required for many users, it is not acceptable to pin the pip version for a such long time. Is there road map to support pip >= 22?

@raimon49
Copy link
Owner

@worroc Who are "many users"? If this is about you, we need information about your environment.

At least in my environment it is working with pip 22.x.

$ pip-licenses --with-system
 Name               Version   License
 PTable             0.9.2     BSD License
 botocore           1.21.53   Apache Software License
 jmespath           0.10.0    MIT License
 pip                22.2.2    MIT License
 pip-licenses       3.5.3     MIT License

@raimon49
Copy link
Owner

raimon49 commented Nov 6, 2022

This proposal was superseded by another excellent proposal that uses importlib_metadata.

@raimon49 raimon49 closed this Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants