question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add pip freeze option to report local directory instead of VCS link

See original GitHub issue

This is a follow up on https://github.com/pypa/pip/issues/4300 which has been automatically locked.

I was tricked by this as well and I am not sure about the reasoning about why pip freeze wants to be super smart and changes the location of a pip install -e to a version control path. Is there some way to turn this behaviour off via command line?

If I would want to specify a version controlled package in the pip freeze output, then I could simply use

pip install -e git+ssh://<package>

to install the package. If instead I use

pip install -e ./some/relative/local/path

I find it very strange that this path is suddenly replaced by a completely different path to a version control system.

Automatically converting local paths to version control paths is a bad idea in my opinion and it actually breaks the usability of pip freeze for us. Converting the path back to a local path afterwards is pretty much impossible, but it is necessary in our infrastructure.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sbidoulcommented, Mar 26, 2020

@uranusjr PEP 610 does have an effect on this issue, albeit indirect.

Actually, providing a VCS url to -e must be seen as a shortcut for git clone project && pip install -e ./project. That’s the way pip works today and I assume it will stay this way.

For editable installs, PEP 610 says the local project directory must be recorded in direct_url.json (the editable flag is in the dir_info structure). The reasoning is that editable is meant for ‘development mode’, and the important part for that is the local project location.

So the way I see it is that pip freeze is indeed trying to be smart with editable installs to workaround the absence of PEP 610. When #7612 is merged, we can start encouraging people not to use -e anymore for the purpose of making pip freeze work with VCS URLs.

Under that light, this issue makes sense, and we will probably want to have a way for pip freeze to emit the project location and not try to infer the VCS url. Of course there will be the question of backward compatibility or if we want to add a new option etc.

0reactions
pradyunsgcommented, May 25, 2020

I’ve labelled this issue as an “deferred PR”.

This label is essentially for indicating that further discussion related to this issue should be deferred until someone comes around to make a PR. This does not mean that the said PR would be accepted - it has not been determined what the appropriate change should look like and that decision has been deferred until the PR is made.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pip freeze, vcs urls and pep 517 (feat. editable installs)
when doing an editable install, frontends add a SRCLOCATION metadata to record the source path of the install (ie the local directory from...
Read more >
`pip freeze` breaks with package installation - Stack Overflow
I had to add the trusted host and extra index url options and install via pip rather than setup.py but this installs without...
Read more >
pip freeze - pip documentation v22.3.1
Only output packages installed in user-site. Restrict to the specified installation path for listing packages (can be used multiple times). Exclude editable ...
Read more >
Python PIP install requirements.txt from PIP Freeze
PIP Freeze looks at the current python environment and what modules/packages have been installed and outputs those modules/packages into a ...
Read more >
pip Documentation
python get-pip.py --no-index --find-links=/local/copies ... Using pip freeze to generate the requirements file will ensure that not only the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found