-
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 messes up egg version with git branches, raising ValueError: 'Expected version spec in' #1083
Comments
+1 am getting this issue as well.. exact same versions |
Me too. Is it a bug or a new backwards incompatible feature? Pip used to dump these with a "-dev" suffix. Now it seems to use "remote/branch" (or sometimes, just "branch"). |
+1 |
2 similar comments
+1 |
+1 |
+1, same versions. It could be fixed in setuptools by changing the regex A quick fix is of course to remove the slashes from your |
I also hit this in pip 1.5. |
It looks like this is where pip adds the egg name:
The
And here it looks like pip is already stripping off the last
So maybe the fix is as easy as having pip strip off a bit more from the end. |
I've just closed #1125 as it's a dupe of this issue. |
It looks like this change may have been introduced back in May 2013 in commit fa81a41. For example, you can see one of the test expectations changing in that commit from
The commit message sounds like it was meant to be only a refactoring ("Combine Git get_tag_revs and get_branch_revs into single get_refs method."), so I wonder whether this change in functionality was indeed deliberate. |
The change in functionality was deliberate in that commit (clearly, since a test was changed), although it's true that the commit message didn't reflect that as it should have. In the course of a refactoring I came across functionality that had been apparently intended by broken/dead code paths in the existing code, and restored it. However, I failed to check the case of a branch name including remote name, and apparently failed to notice that the previous dead code path had tried to handle that case with an removal of an "origin/" prefix (which I think is overly simplistic, since it assumes the only possible remote name is "origin"). I think the right solution here is, when constructing |
Thanks for replying so quickly, @carljm.
It seems somewhat common to have branch names with a slash in it. To name one example, Django has a series of branches of the form |
@cjerdonek Short of a change to the regex in setuptools as suggested above (which may have other consequences I'm not aware of, and I'm not sure would be accepted by the setuptools maintainers), it's not possible to maintain such branch names unmodified. This egg version is not functionally important; using anything other than "dev" here is simply an attempt to give a better human-readable clue as to which version of the package is in use. In the case of Django you mention, the resulting egg name would be "Django-1.4.x" if the branch was "stable/1.4.x", which still seems reasonable and more useful than "Django-dev". Another option would be to translate slashes to some other allowed character (underscore?); it's not clear to me that "Django-origin_stable_1.4.x" is really better than "Django-1.4.x", though. Perhaps there are other cases where it would be preferable, but my guess is that in general a) the remote name is not very useful there, and b) in most cases where branch names with slashes are in use, the final portion is probably adequate as a human-readable hint. |
Okay, good to know that the name isn't functionally important. For readability/usability, my instinct would be to lean towards stripping the remote name off the front and then convert slashes to underscores. So in the example, it would be ""Django-stable_1.4.x". Locating the corresponding branch name is more immediate if it at least begins with the same characters (otherwise you have to scan every name for the final segment). |
Sure, that seems fine to me. According to @mrmachine above, the remote name is only sometimes included, so in order to implement this approach it would be necessary to figure out when it is or isn't, so the remote name alone can be reliably stripped if present. |
By the way, the pip documentation can probably use some clarification in this area. For example, the VCS Support section says:
which doesn't leave open the possibility of suffixes of the form
|
+1 |
Hi all, is there any fix available for this issue? |
On Python > 3.2, it's even worse as the generated egg name is non-deterministic and can vary from run to run - see #1867 |
per outstanding pip bug pypa/pip#1083
+1 |
The output from "pip freeze" isn't usable under some circumstances: pypa/pip#1083
+1 |
I'll start working on this and see if I can make some progress. |
I made a minimal fix with some tests for this issue: #2063 The fix simply translates slashes in the existing egg "surname" to underscores -- as discussed in this comment: #1083 (comment) |
I'm happy to test this fix, probably will be able to do that tomorrow. Thanks! |
Hello, I got this issue while trying to install an egg file that was generated in a subdirectory
failed
worked. edit: whatever, pip does not work at all this way ! I need easy_install to install from an egg file. |
I have a requirements.txt containing this line:
When dumping pip freeze, it writes this:
This cannot be installed with pip, it raises:
The text was updated successfully, but these errors were encountered: