-
Notifications
You must be signed in to change notification settings - Fork 3k
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
pip freeze does not list repo url #609
Comments
pip's ability to discern where the install came from is limited after the fact using pip freeze. btw, since you asked about "-e" in the stack link, "-e" or "editable" is an enhancement of what setuptools called a "develop" install. this is an "installation" that does not occur via copying packages into site-packages. |
A typical example is given in #4005.
|
@xavfernandez is this still an issue? |
Yes. |
What's the problem this feature will solve? Abstract: this issue is becoming more acute now that pep517 is a thing and it does not support editable installs. When installing vcs dependencies without --editable, the exact installed version is lost when subsequently doing a pip freeze. When installing with --editable, it is preserved. Preserving the installed vcs reference is actually my main (if not only) use case for using --editable. My problem today is that pep517 does not support --editable, so if I want to pip install from vcs a pep517 project which has no setup.py, I loose the ability to do a reliable pip freeze. Here is an example installing a pep517 project in a virtualenv (flit): $ mktmpenv -p python3
$ pip install git+https://github.com/takluyver/flit.git
$ pip freeze
certifi==2019.3.9
chardet==3.0.4
docutils==0.14
flit==1.3
idna==2.8
pytoml==0.1.20
requests==2.21.0
urllib3==1.24.1 So with this method, I loose the information about the exact flit commit installed, and pip freeze does not give me something reproducible. If I try with -e, it fails because pip install -e assumes setuptools is present: $ mktmpenv -p python3
$ pip install -e git+https://github.com/takluyver/flit.git#egg=flit
[...]
Installing collected packages: certifi, chardet, urllib3, idna, requests, pytoml, docutils, flit
Running setup.py develop for flit
Complete output from command /home/sbi/.virtualenvs/tempenv-04f816243221f/bin/python3 -c "import setuptools, tokenize;__file__='/home/sbi/.virtualenvs/tempenv-04f816243221f/src/flit/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools' Describe the solution you'd like I understand adding editable support to pep517 is a hard problem. Perhaps it is not needed for this use case, and a simpler approach would be to have pip preserve the installed vcs reference somewhere to restitute it in pip freeze? I'm willing attempt a PR, but I'm not sure where pip could store this information, assuming such a place exists at all today? Could someone give me some guidance as to where to start? |
I don't think what you're asking has a simple or clear solution, so I'd suggest beginning by gathering / brainstorming ideas. Also, is this a feature that you're thinking would be limited to things installed with pip? |
@cjerdonek Thanks for jumping in. Here are some thoughts. So we'd need some sort of metadata in dist-info. Perhaps a VCSORIGIN field?
Could work, but I dot not feel very comfortable with it and when thinking about this I always come back to editable installs. I played a bit with poetry and flit. In presence of a git dependency, poetry always does an "editable" install, in the sense it creates a .egg-link, so pip freeze works. Flit, like pip install without -e, does nothing special and loses the VCS origin after installation so pip freeze does not work. OTOH, flit has an interesting 'install --symlink' which generates a regular .dist-info, but does not copy the source code and symlinks it instead (or plays with .pth files in a variant that supports platforms without symlinks). pip freeze does not work in this case either because it exclusively relies on the presence of .egg-link to find the source location. I like what flit does here very much, as it uses dist-info metadata and is very flexible So a better approach could be going all the way to implement "editable" installs in pep 517? I could not find the discussion that led to its temporary exclusion from pep 517. From the use cases I can imagine it could be relatively simple along these lines:
If we can go with the editable install approach, we could then close this issue as not supported and direct people who need it to use --editable. Perhaps I'm opening too big a can of worms? Yet I think editable installs must become part of pep 517 sooner than later, and this could be a good motivation to move it forward. Is it the right place to brainstorm this? Should we involve other people here or open the discussion somewhere else? |
If you wanted a wider discussion, the best place is probably to start a new topic under the "Packaging" category of the Python Discourse instance: https://discuss.python.org/c/packaging I'm not sure how much traction you'll get though because PEP 517 was complex and highly contentious and drawn out (one of the reasons for removing editable), and there was an update even as recently as a month or so ago. So I'm guessing the participants will need a breather before picking up a new, hard topic like this that has long-term implications. But it could help to get people thinking and get some initial thoughts. |
The discussion on the spec which is a prerequisite to implement this is at https://discuss.python.org/t/draft-pep-recording-the-origin-of-distributions-installed-from-direct-url-references/1535 |
Wow, never expected that my feature request from seven years ago would still be discussed and even had a spec written on it. You have my respect. |
Related PEP: python/peps#1145 |
Don't worry about BDFL-Delegate, as I have that role for all packaging interop PEPs. A sponsor is a requirement for the PEP process, so I think you do need one. Also, the fact that you have all these questions is precisely what having a sponsor should address. It's difficult to argue that you don't need one because @cjerdonek co-authored, while still pointing out that he's currently not available and hence you need all of these questions answered ;-) Honestly, I think you may be better just waiting for @cjerdonek to be available to assist - I'm not clear why this PEP is so urgent that it couldn't wait for that. |
In good open source tradition, I have an itch that I can scratch by implementing this issue (which was tagged In the grand scheme of things, nothing is urgent of course. This issue is 7 years old. I proposed to work on it 7 months ago, did all the PEP writing and editorial work with Chris (4 months), then waited 3 more months after opening the PEP PR, before concluding that Chris was not available and kindly asking for an alternative to get it moving. I'm not complaining nor anything, yet I must say I feel more and more like Asterix in his 12 tasks, in the part when he has to navigate a kafkaian administration ;-) |
I sympathise. Maybe the best approach would be to ask on the original thread for this PEP for someone who can act as a sponsor. That's the most likely place to find someone who is a core dev, who is also interested in the proposal. |
Hey @sbidoul, I'm not sure if it helps expedite the process, but you have my vote as well :) |
@bmartinn thanks for the support. There were a few comments on PEP 610 since it's up for review (thanks @uranusjr and @chrahunt), none of which raising blocking issue on the concept. However the PEP has not raised interest from python core devs, so that path seems to be closed for now. That said I'm still very much motivated to implement this pip freeze improvement. @pypa/pip-committers, would you see an objection if I make a PR that solves this issue, by implementing PEP 610, except it would name the file This could serve as a real world implementation for the PEP, to discover and weed out any issue in it. We would not document the file format and we'd make it clear that the file is not intended to be interoperable, and that if other tools want to use it people need to go and review PEP 610. This way we are not growing the pip public surface area, we are just making pip freeze work the way it should in more cases. If and when the PEP get approved, it will be easy to introduce a transition path. |
@sbidoul for what it's worth, I think that's a good compromise. It will definitely expand the transparency of the installed packages on the system, with not a lot strings attached (in terms of committing to a strict standard). |
@bmartinn the PEP got a new sponsor, so thing are moving again. I'm currently writing a new version of the PEP that integrates all the review comments. |
A proposed implementation is in #7612. People interested in testing this can do it by installing pip from that branch: |
Thanks @sbidoul ! I'll check the PR |
Just wanted to chime in saying that this worked for me! |
Also chiming in to say I've used this PR to create "nested" dependencies (i.e., packageA depends on packageB depends on packageC, etc.) by using PEP 440 direct references to git repositories in In short, this PR (and the Herculean effort being put in to create PEP 610 and address this issue) helps users like me who are still running into the pre-PEP-517/518 variant of this issue too. |
@pradyunsg is this feature worth calling out in the release notes? |
Wouldn't the entry for #609 cover this? |
We have now (per #7951) published a beta release of pip, pip 20.1b1. This release includes #7612, which implemented a solution for this issue. I hope participants in this issue will help us by testing the beta and checking for new bugs. We'd like to identify and iron out any potential issues before the main 20.1 release on Tuesday. I also welcome positive feedback along the lines of "yay, it works better now!" as well, since the issue tracker is usually full of "issues". :) |
@pradyunsg It works!!! It's so awesome! Minor caveat though :) If you do sudo pip install git+https://github.com/... Then when you run
As you can see the
I tested running Other than this minor issue, great job guys! 👍 |
@bmartinn That's expected. I think that's a permissions situation with your system. Any files created by a sudo'ed command would be owned by root, and it might be the case that these files aren't readable. To verify this -- check if anything in Other than that, in general, we strongly recommend users to not use |
@pradyunsg I verified, the
Definitely agree on this one, but you asked to test the new feature, so I did :) |
Ah yes, I was wrong about why this is happening. :) Thanks for filing that separate issue @bmartinn and your report is much appreciated! ^>^ |
118: Update pip to 20.1 r=duckinator a=pyup-bot This PR updates [pip](https://pypi.org/project/pip) from **20.0.2** to **20.1**. <details> <summary>Changelog</summary> ### 20.1 ``` ================= Process ------- - Document that pip 21.0 will drop support for Python 2.7. Features -------- - Add ``pip cache dir`` to show the cache directory. (`7350 <https://github.com/pypa/pip/issues/7350>`_) Bug Fixes --------- - Abort pip cache commands early when cache is disabled. (`8124 <https://github.com/pypa/pip/issues/8124>`_) - Correctly set permissions on metadata files during wheel installation, to permit non-privileged users to read from system site-packages. (`8139 <https://github.com/pypa/pip/issues/8139>`_) ``` ### 20.1b1 ``` =================== Deprecations and Removals ------------------------- - Remove emails from AUTHORS.txt to prevent usage for spamming, and only populate names in AUTHORS.txt at time of release (`5979 <https://github.com/pypa/pip/issues/5979>`_) - Remove deprecated ``--skip-requirements-regex`` option. (`7297 <https://github.com/pypa/pip/issues/7297>`_) - Building of local directories is now done in place, instead of a temporary location containing a copy of the directory tree. (`7555 <https://github.com/pypa/pip/issues/7555>`_) - Remove unused ``tests/scripts/test_all_pip.py`` test script and the ``tests/scripts`` folder. (`7680 <https://github.com/pypa/pip/issues/7680>`_) Features -------- - pip now implements PEP 610, so ``pip freeze`` has better fidelity in presence of distributions installed from Direct URL requirements. (`609 <https://github.com/pypa/pip/issues/609>`_) - Add ``pip cache`` command for inspecting/managing pip's wheel cache. (`6391 <https://github.com/pypa/pip/issues/6391>`_) - Raise error if ``--user`` and ``--target`` are used together in ``pip install`` (`7249 <https://github.com/pypa/pip/issues/7249>`_) - Significantly improve performance when ``--find-links`` points to a very large HTML page. (`7729 <https://github.com/pypa/pip/issues/7729>`_) - Indicate when wheel building is skipped, due to lack of the ``wheel`` package. (`7768 <https://github.com/pypa/pip/issues/7768>`_) - Change default behaviour to always cache responses from trusted-host source. (`7847 <https://github.com/pypa/pip/issues/7847>`_) - An alpha version of a new resolver is available via ``--unstable-feature=resolver``. (`988 <https://github.com/pypa/pip/issues/988>`_) Bug Fixes --------- - Correctly freeze a VCS editable package when it is nested inside another VCS repository. (`3988 <https://github.com/pypa/pip/issues/3988>`_) - Correctly handle ``%2F`` in URL parameters to avoid accidentally unescape them into ``/``. (`6446 <https://github.com/pypa/pip/issues/6446>`_) - Reject VCS URLs with an empty revision. (`7402 <https://github.com/pypa/pip/issues/7402>`_) - Warn when an invalid URL is passed with ``--index-url`` (`7430 <https://github.com/pypa/pip/issues/7430>`_) - Use better mechanism for handling temporary files, when recording metadata about installed files (RECORD) and the installer (INSTALLER). (`7699 <https://github.com/pypa/pip/issues/7699>`_) - Correctly detect global site-packages availability of virtual environments created by PyPA’s virtualenv>=20.0. (`7718 <https://github.com/pypa/pip/issues/7718>`_) - Remove current directory from ``sys.path`` when invoked as ``python -m pip <command>`` (`7731 <https://github.com/pypa/pip/issues/7731>`_) - Stop failing uninstallation, when trying to remove non-existent files. (`7856 <https://github.com/pypa/pip/issues/7856>`_) - Prevent an infinite recursion with ``pip wheel`` when ``$TMPDIR`` is within the source directory. (`7872 <https://github.com/pypa/pip/issues/7872>`_) - Significantly speedup ``pip list --outdated`` by parallelizing index interaction. (`7962 <https://github.com/pypa/pip/issues/7962>`_) - Improve Windows compatibility when detecting writability in folder. (`8013 <https://github.com/pypa/pip/issues/8013>`_) Vendored Libraries ------------------ - Update semi-supported debundling script to reflect that appdirs is vendored. - Add ResolveLib as a vendored dependency. - Upgrade certifi to 2020.04.05.1 - Upgrade contextlib2 to 0.6.0.post1 - Upgrade distro to 1.5.0. - Upgrade idna to 2.9. - Upgrade msgpack to 1.0.0. - Upgrade packaging to 20.3. - Upgrade pep517 to 0.8.2. - Upgrade pyparsing to 2.4.7. - Remove pytoml as a vendored dependency. - Upgrade requests to 2.23.0. - Add toml as a vendored dependency. - Upgrade urllib3 to 1.25.8. Improved Documentation ---------------------- - Emphasize that VCS URLs using git, git+git and git+http are insecure due to lack of authentication and encryption (`1983 <https://github.com/pypa/pip/issues/1983>`_) - Clarify the usage of --no-binary command. (`3191 <https://github.com/pypa/pip/issues/3191>`_) - Clarify the usage of freeze command in the example of Using pip in your program (`7008 <https://github.com/pypa/pip/issues/7008>`_) - Add a "Copyright" page. (`7767 <https://github.com/pypa/pip/issues/7767>`_) - Added example of defining multiple values for options which support them (`7803 <https://github.com/pypa/pip/issues/7803>`_) ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/pip - Changelog: https://pyup.io/changelogs/pip/ - Homepage: https://pip.pypa.io/ </details> Co-authored-by: pyup-bot <github-bot@pyup.io>
This was installed at https://pip.pypa.io/en/stable/news/#b1-2020-04-21
It isn't reporting repo url:
|
@flywire the installation went via the legacy
|
Hi all, @sbidoul can you expand a little bit more on using the |
|
Here's the detailed problem: http://stackoverflow.com/questions/11560056/pip-freeze-does-not-show-repository-paths-for-requirements-file
The text was updated successfully, but these errors were encountered: