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

pip requires the "-e" option to install from a scheme that starts with "git+git@" #2994

Closed
Kentzo opened this issue Jul 29, 2015 · 17 comments
Closed
Labels
auto-locked Outdated issues that have been locked by automation C: editable Editable installations C: vcs pip's interaction with version control systems like git, svn and bzr state: needs discussion This needs some more discussion type: bug A confirmed bug or unintended behavior

Comments

@Kentzo
Copy link

Kentzo commented Jul 29, 2015

Looks like it's not recognized and passed further into pkg_resources:

Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/pip/basecommand.py", line 223, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.4/site-packages/pip/commands/install.py", line 270, in run
    wheel_cache
  File "/usr/local/lib/python3.4/site-packages/pip/basecommand.py", line 275, in populate_requirement_set
    wheel_cache=wheel_cache
  File "/usr/local/lib/python3.4/site-packages/pip/req/req_install.py", line 212, in from_line
    wheel_cache=wheel_cache, constraint=constraint)
  File "/usr/local/lib/python3.4/site-packages/pip/req/req_install.py", line 66, in __init__
    req = pkg_resources.Requirement.parse(req)
  File "/usr/local/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2980, in parse
    reqs = list(parse_requirements(s))
  File "/usr/local/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2924, in parse_requirements
    "version spec")
  File "/usr/local/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2889, in scan_list
    raise RequirementParseError(msg, line, "at", line[p:])
pip._vendor.pkg_resources.RequirementParseError: Expected version spec in git+git@github.com:My/repo.git@master#egg=repo at +git@github.com:My/repo.git@master#egg=repo
@ajk8
Copy link

ajk8 commented Oct 23, 2015

+1

1 similar comment
@ghost
Copy link

ghost commented Nov 10, 2015

+1

@RonnyPfannschmidt
Copy link
Contributor

isnt it ssh+git?

@RonnyPfannschmidt
Copy link
Contributor

whops, the other way around

@dmytroleonenko
Copy link

+1

1 similar comment
@averges
Copy link

averges commented Jan 27, 2016

+1

@xavfernandez
Copy link
Member

Well the valid url: git+ssh://git@github.com/My/repo.git is accepted by both.

I'd be more in favor of dropping support of the unholy, pip-specific git+git@github.com:My/repo.git syntax.

@Ivoz
Copy link
Contributor

Ivoz commented Feb 1, 2016

@xavfernandez minus the git+ (which is the pip specific part to any VCS url), git@github.com:My/repo.git is git specific, not pip specific. git docs say it is scp-like / accepted by ssh.

@xavfernandez
Copy link
Member

I understand that, I just find it strange we needed to invent our own url like syntax.

>>> urlparse('git+git@github.com:My/repo.git')
ParseResult(scheme='', netloc='', path='git+git@github.com:My/repo.git', params='', query='', fragment='')
>>> urlparse('git+ssh://git@github.com/My/repo.git')
ParseResult(scheme='git+ssh', netloc='git@github.com', path='/My/repo.git', params='', query='', fragment='')

cc @rbtcollins @dstufft whether this needs to be added to PEP508

(For the record, I'd be in favor of dropping it)

@rbtcollins
Copy link

git+git@github.com: is not a URL - its an ssh style host reference, not a URL/URI.. https://www.ietf.org/proceedings/59/I-D/draft-ietf-secsh-scp-sftp-ssh-uri-01.txt covers ssh uri's, though its only a draft, and http://www.iana.org/assignments/uri-schemes/prov/git covers git:// urls - dropping support for the host reference stuff from pip is entirely appropriate.

@pradyunsg
Copy link
Member

pradyunsg commented Aug 21, 2017

@dstufft @pfmoore @xavfernandez @rbtcollins Thoughts on this?

I'm in favour of deprecating and then dropping support for git+git; printing a message saying use git+shh instead.

@pradyunsg pradyunsg added state: needs discussion This needs some more discussion type: bug A confirmed bug or unintended behavior C: vcs pip's interaction with version control systems like git, svn and bzr labels Aug 21, 2017
@cjerdonek cjerdonek added the C: editable Editable installations label Aug 20, 2018
@shelldweller
Copy link

shelldweller commented Feb 7, 2019

It's actually the same problem with git+ssh. Only git+https works in non-editable mode which appears to contradict documentation.

Here's what I get:

# git+git doesn't work:
pip install git+git@github.com:shelldweller/etlite.git#egg=etlite
Invalid requirement: 'git+git@github.com:shelldweller/etlite.git#egg=etlite'
It looks like a path. File 'git+git@github.com:shelldweller/etlite.git#egg=etlite' does not exist.

# neither does git+ssh:
pip install git+ssh@github.com:shelldweller/etlite.git#egg=etlite
Invalid requirement: 'git+ssh@github.com:shelldweller/etlite.git#egg=etlite'
It looks like a path. File 'git+ssh@github.com:shelldweller/etlite.git#egg=etlite' does not exist.

# But git+https does:
pip install git+https://github.com/shelldweller/etlite.git
Collecting git+https://github.com/shelldweller/etlite.git
...

# And so does "editable" mode:
pip install -e git+git@github.com:shelldweller/etlite.git#egg=etlite
Obtaining etlite from git+git@github.com:shelldweller/etlite.git#egg=etlite
  Cloning git@github.com:shelldweller/etlite.git to ./.venv/src/etlite
...

Additionally on Windows, non-editable mode is broken in a different way:

pip install git+git@github.com:shelldweller/etlite.git#egg=etlite
Invalid requirement: 'git+git@github.com:shelldweller/etlite.git#egg=etlite'
= is not a valid operator. Did you mean == ?

# but in editable mode it's fine:
install -e git+git@github.com:shelldweller/etlite.git#egg=etlite
Obtaining etlite from git+git@github.com:shelldweller/etlite.git#egg=etlite
  Cloning git@github.com:shelldweller/etlite.git
...

All examples are reproduced with pip 19.0.1 and Python 3.6.7.

@xavfernandez
Copy link
Member

What you want is git+ssh://git@github.com/shelldweller/etlite.git#egg=etlite

@shelldweller
Copy link

Um... I was saying that git+ssh behaves just like git+git and that (contrary to documentation) neither supports non-editable mode. Occasionally it may be desirable to pip install from git+ssh without the -e option.

@xavfernandez
Copy link
Member

The documentation might be clearer but from https://pip.pypa.io/en/latest/reference/pip_install/#git:
git+git installation only works in editable mode (hence the -e) but git+ssh works in editable and non-editable mode (hence the [-e]).
pip install git+ssh://git@github.com/shelldweller/etlite.git#egg=etlite works fine.

@shelldweller
Copy link

shelldweller commented Feb 14, 2019

I see. Thanks @xavfernandez. The confusion (at least for me) comes from the differences in URL format:
git+ssh://git@github.com/user works but git+ssh://git@github.com:user doesn't. Interestingly all major VCS providers (Github, Bitbucket, GitLab) give you SSH clone URL in the latter format. It is not obvious at all that one has to tweak the URL for it to work in non-editable mode.

@sbidoul
Copy link
Member

sbidoul commented Jan 4, 2020

Closing as we propose to remove the git+git@ form in #7554.

@sbidoul sbidoul closed this as completed Jan 4, 2020
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Feb 3, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Feb 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation C: editable Editable installations C: vcs pip's interaction with version control systems like git, svn and bzr state: needs discussion This needs some more discussion type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests