5

I am working with a repo which has the following structure:

  • foo/bar/setup.py
  • foo/bar/mypackage

I am attempting to install this package using something like:

pip install git+ssh://[email protected]/owner/repo-namegit@commithash#egg=mypackage&subdirectory=foo/bar

However, it just hangs here and doesn't seem to respond.

Their documentation doesn't have an example of a multiple nested directory package path like that. However it does say, emphasis mine:

For projects where setup.py is not in the root of project, "subdirectory" component is used. Value of "subdirectory" component should be a path starting from root of the project to where setup.py is located

What does the properly formed installation from pip for a multiple-directory look like?

The above is returning errors such as:

  Could not find a tag or branch 'commit', assuming commit.
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    IOError: [Errno 2] No such file or directory: '/var/folders/wf/89r2567s5hv48lj1g9l65mbw0000gp/T/pip-gAwA3W-build/setup.py'

I see this using all versions of pip I tested (9.0.1 and 8.1.1).

Here is the detailed log:

$ pip install git+ssh://[email protected]/user/repo.git@hash#egg=projectname&subdirectory=lib/python
[1] 4195

Collecting projectname from git+ssh://[email protected]/user/repogit@hash#egg=projectname
  Cloning ssh://[email protected]/user/repo.git (to 8d109c760ae8a9599299924be1b78645e2617a50) to /private/var/folders/wf/89r2567s5hv48lj1g9l65mbw0000gp/T/pip-build-w01D4G/repo
  Could not find a tag or branch 'hash', assuming commit.
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    IOError: [Errno 2] No such file or directory: '/private/var/folders/wf/89r2567s5hv48lj1g9l65mbw0000gp/T/pip-build-w01D4G/repo/setup.py'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/wf/89r2567s5hv48lj1g9l65mbw0000gp/T/pip-build-w01D4G/repo/

[1]+  Exit 1                  pip install git+ssh://[email protected]/user/repo.git@hash#egg=projectname

It looks like after the initial subdirectory line where I call it, that part of the pip command is disappearing?

3
  • Just noting that there's no @ before egg (as in it should be pip install git+ssh://[email protected]/owner/repo-namegit@commithash#egg=mypackage&subdirectory=foo/bar instead of pip install git+ssh://[email protected]/owner/repo-namegit@commithash#@egg=mypackage&subdirectory=foo/bar) Commented Nov 21, 2016 at 23:41
  • subdirectory is definitely how to specify a subdirectory (i.e. pip install 'git+https://github.com/pallets/click.git@master#egg=click-example-naval&subdirectory=examples/naval/'). I think your problem is caused by something else (problems cloning the repo? incorrect syntax specifying the commit sha? ...). Commented Nov 22, 2016 at 3:00
  • @EugenConstantinDinca I removed that and added additional logs, it's still not doing what the docs seem to suggest? Commented Nov 22, 2016 at 15:38

1 Answer 1

15

When using multiple operators with pip, the entire argument needs to be enclosed in quotes:

pip install git+ssh://[email protected]/owner/repo-name.git@commithash#"egg=mypackage&subdirectory=foo/bar"

Otherwise, pip drops anything after the & and does not successfully recognize this.

Sign up to request clarification or add additional context in comments.

1 Comment

Quick notes: 1) it's your shell doing the drop anything after the &, not pip & 2) you can enclose in quotes (double or single) the entire argument to pip install (i.e. pip install "git+ssh://[email protected]/owner/repo-namegit@commithash#egg=mypackage&subdirectory=foo/bar").

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.