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

Unable to install package from private repository #1393

Closed
clayk opened this issue Feb 2, 2018 · 41 comments
Closed

Unable to install package from private repository #1393

clayk opened this issue Feb 2, 2018 · 41 comments

Comments

@clayk
Copy link

clayk commented Feb 2, 2018

I am attempting to install from a private repository. The output indicates the package and dependencies were installed but when pipenv is "Locking [packages] dependencies…"

I receive an error indicating: pip.exceptions.InstallationError: Could not detect requirement name, please specify one with #egg=

Describe your environment
  1. macOS 10.13.2
  2. Python version: Python 3.6.3
  3. Pipenv version: pipenv, version 9.0.3
Expected result

I am expecting for the package to install and the lockfile to be written.

Actual result
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Traceback (most recent call last):
  File "/Users/clayk/Library/Python/3.6/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/Users/clayk/Library/Python/3.6/lib/python/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/clayk/Library/Python/3.6/lib/python/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/clayk/Library/Python/3.6/lib/python/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/clayk/Library/Python/3.6/lib/python/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/clayk/Library/Python/3.6/lib/python/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/clayk/Library/Python/3.6/lib/python/site-packages/pipenv/cli.py", line 1934, in install
    do_lock(system=system, pre=pre)
  File "/Users/clayk/Library/Python/3.6/lib/python/site-packages/pipenv/cli.py", line 1102, in do_lock
    pre=pre
  File "/Users/clayk/Library/Python/3.6/lib/python/site-packages/pipenv/utils.py", line 545, in resolve_deps
    resolved_tree = actually_resolve_reps(deps, index_lookup, markers_lookup, project, sources, verbose, clear, pre)
  File "/Users/clayk/Library/Python/3.6/lib/python/site-packages/pipenv/utils.py", line 470, in actually_resolve_reps
    constraint = pip.req.InstallRequirement.from_editable(dep[len('-e '):])
  File "/Users/clayk/Library/Python/3.6/lib/python/site-packages/pipenv/patched/pip/req/req_install.py", line 143, in from_editable
    editable_req, default_vcs)
  File "/Users/clayk/Library/Python/3.6/lib/python/site-packages/pipenv/patched/pip/req/req_install.py", line 1196, in parse_editable
    "Could not detect requirement name, please specify one with #egg="
pip.exceptions.InstallationError: Could not detect requirement name, please specify one with #egg=
Steps to replicate

execute pipenv install -e git+ssh://path/to/private/Redacted.git@v1.1.8#egg=privatepackagename

@guaguanco
Copy link

I just started seeing this problem as well, but when I update the package rather than when I'm installing it.

In the Pipfile I have an entry like:

mypkg = {git = "file:///some/path/to/working/dir", editable = true, subdirectory = "inside/workdir"}

when I run pipenv update mypkg the package gets uninstalled and reinstalled correctly, but at the end pipenv tries to add a new entry using just part of the original one, and in the Pipfile I get:

mypkg = {git = "file:///some/path/to/working/dir", editable = true, subdirectory = "inside/workdir"}
"a65c66e" = {path = "git+file:///some/path/to/working/dir", editable = true}

As you can see there's no #egg because the mypkg name is lost, and no subdirectory.

I'm sure it used to work.

Now I have to manually remove that additional line to keep my Pipfile clean, fortunately the update works so I can keep on until this is fixed

@hcoura
Copy link

hcoura commented Feb 27, 2018

I am also seeing similar problems.

When installing without the -e flag the package is installed, but if I pipenv install afterwards I get:

Installing dependencies from Pipfile.lock (5fd147)…
An error occurred while installing git+git@github.com/my/package/! Will try again.
Installing initially–failed dependencies…
Invalid requirement: 'git+git@github.com/my/package/'
It looks like a path. Does it exist ?

If I install the same package with the -e flag I get:

Locking [dev-packages] dependencies…
Locking [packages] dependencies…
fatal: repository 'git@github.com/my/package.git' does not exist
Traceback (most recent call last):
  File "/home/henrique/miniconda3/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/cli.py", line 213, in install
    deploy=deploy
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/core.py", line 1795, in do_install
    do_lock(system=system, pre=pre)
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/core.py", line 1113, in do_lock
    allow_global=system
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/utils.py", line 340, in resolve_deps
    resolved_tree, resolver = actually_resolve_reps(deps, index_lookup, markers_lookup, project, sources, verbose, clear, pre)
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/utils.py", line 301, in actually_resolve_reps
    resolved_tree.update(resolver.resolve(max_rounds=PIPENV_MAX_ROUNDS))
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/patched/piptools/resolver.py", line 102, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/patched/piptools/resolver.py", line 200, in _resolve_one_round
    for dep in self._iter_dependencies(best_match):
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/patched/piptools/resolver.py", line 274, in _iter_dependencies
    for dependency in self.repository.get_dependencies(ireq):
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 153, in get_dependencies
    result = reqset._prepare_file(self.finder, ireq)
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/patched/pip/req/req_set.py", line 521, in _prepare_file
    req_to_install.update_editable(not self.is_download)
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/patched/pip/req/req_install.py", line 587, in update_editable
    vcs_backend.export(self.source_dir)
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/patched/pip/vcs/git.py", line 69, in export
    self.unpack(temp_dir)
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/patched/pip/vcs/__init__.py", line 286, in unpack
    self.obtain(location)
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/patched/pip/vcs/git.py", line 142, in obtain
    self.run_command(['clone', '-q', url, dest])
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/patched/pip/vcs/__init__.py", line 325, in run_command
    spinner)
  File "/home/henrique/miniconda3/lib/python3.6/site-packages/pipenv/patched/pip/utils/__init__.py", line 707, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command "git clone -q git@github.com/my/package.git /tmp/pip-53zad75t-export" failed with error code 128 in None

@bokhi
Copy link

bokhi commented Mar 4, 2018

@techalchemy
To install a private github repository from pip the syntax is
pip install git+ssh://git@github.com/username/repo.git@branch#egg=blah

This worked properly with pipenv up to version 9
pipenv install git+ssh://git@github.com/username/repo.git@branch#egg=blah

but with pipenv 11
pipenv install git+ssh://git@github.com/username/repo.git@branch#egg=blah
returns with the an error for
git clone -q git@github.com/username/repo.git /tmp/temp
it's because the correct syntax should be git clone -q git@github.com:username/repo.git /tmp/temp with : and not /

@Moritz90
Copy link

Moritz90 commented Mar 6, 2018

@bokhi
You're close to the actual issue, but your proposed fix is incorrect. The problem is not the slash, but the fact that the leading ssh:// is omitted, causing pipenv to prompt for the ssh password for user git in my case.

I'm trying to install a package from a private Bitbucket repository from which you can only clone via SSH, not HTTPS. Pipenv tries to execute git clone -q git@host:7999/project/repo.git instead of git clone -q ssh://git@host:7999/project/repo.git.

@Moritz90
Copy link

Moritz90 commented Mar 6, 2018

For some reason, the stack trace is cut off. Here's what I get:

.py", line 162, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "/home/moritz/.local/lib/python2.7/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 199, in get_legacy_dependencies
    result = reqset._prepare_file(self.finder, ireq)
  File "/home/moritz/.local/lib/python2.7/site-packages/pipenv/patched/pip/req/req_set.py", line 521, in _prepare_file
    req_to_install.update_editable(not self.is_download)
  File "/home/moritz/.local/lib/python2.7/site-packages/pipenv/patched/pip/req/req_install.py", line 587, in update_editable
    vcs_backend.export(self.source_dir)
  File "/home/moritz/.local/lib/python2.7/site-packages/pipenv/patched/pip/vcs/git.py", line 69, in export
    self.unpack(temp_dir)
  File "/home/moritz/.local/lib/python2.7/site-packages/pipenv/patched/pip/vcs/__init__.py", line 286, in unpack
    self.obtain(location)
  File "/home/moritz/.local/lib/python2.7/site-packages/pipenv/patched/pip/vcs/git.py", line 142, in obtain
    self.run_command(['clone', '-q', url, dest])
  File "/home/moritz/.local/lib/python2.7/site-packages/pipenv/patched/pip/vcs/__init__.py", line 325, in run_command
    spinner)
  File "/home/moritz/.local/lib/python2.7/site-packages/pipenv/patched/pip/utils/__init__.py", line 707, in call_subprocess
    % (command_desc, proc.returncode, cwd))

@techalchemy
Copy link
Member

That’s not where the problem is but it is actually really helpful. If you use the git+git@ syntax it should work until I get a fix in place

@Moritz90
Copy link

Moritz90 commented Mar 6, 2018

@techalchemy How do you even specify the port with the syntax git+git@host:project/repo.git? I've tried a few variants and each of them results in a similar prompt for git's password (which should not happen). The only difference is that I don't get a stacktrace after entering something incorrect.

@techalchemy
Copy link
Member

From https://pip.pypa.io/en/stable/reference/pip_install/#git

Here are the supported forms:
...
-e git+git@git.myproject.org:MyProject#egg=MyProject

Naturally if you use an ssh based approach you will need to have a password or a key pair for authentication. You can also use an http based approach which is not going to be impacted by this bug: git+https://git.myhost.org/myrepo.git#egg=myrepo

Please read the pip documentation if you want to know how to interact with vcs repositories.

@Moritz90
Copy link

Moritz90 commented Mar 6, 2018

I read the pip documentation (the exact page you posted) and it doesn't cover how to specify the port when using this type of URI, which you've suggested as a workaround. That's why I asked.

As mentioned above, HTTP access is disabled in our Bitbucket instance. My public key is correctly registered with Bitbucket and normal interaction via git and installation of the package via pip itself work perfectly fine.

But no matter what I try, I cannot get pipenv to install the package. The fact that it's asking for a password for git makes me suspect that it's always connecting to the regular SSH server on port 22, not the Bitbucket SSH server on port 7999.

Sorry if what I wrote before wasn't clear enough.

@techalchemy
Copy link
Member

Does simply adding the port like you would to a normal url not work?

@Moritz90
Copy link

Moritz90 commented Mar 6, 2018

I've tried the following variations:

  • git+git@host:port/project/repo.git#egg=...
  • git+git@host:port:project/repo.git#egg=...

Both don't work, since in this URL scheme, everything behind the first colon seems to be interpreted as the path.

@Moritz90
Copy link

Moritz90 commented Mar 6, 2018

A bit of additional info:

After the initial installation attempt (pipenv install -e git+ssh://...), the Pipfile contains the following line:

package = {git = "git@host:7999/project/repo.git", editable = true}

The step Locking [packages] dependencies… then immediately fails (i.e. asks for the password).

I tried to manually change the line to the following:

package = {git = "ssh://git@host:7999/project/repo.git", editable = true}

Running pipenv install after that change results in a partial success:

Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (28b5f3)!
Installing dependencies from Pipfile.lock (28b5f3)…

This time, it at least installs all dependencies of the package correctly before failing to install the package itself (asking for the password). pipenv run pip freeze shows that the dependencies were indeed installed correctly.

Hope that helps track down the problem.

Edit: Manually adding "ssh://" in Pipfile.lock as well makes pipenv install succeed. I guess that's my workaround for now, then.

@techalchemy
Copy link
Member

@Moritz90 thanks for the thorough debug, I'll get a fix together for this which will be much easier because of this info

@clayk
Copy link
Author

clayk commented Mar 6, 2018

@techalchemy will this fix also help with the original issue filed? It seems the discussion has shifted slightly regarding SSH specifics.

@techalchemy
Copy link
Member

yes

@techalchemy
Copy link
Member

To clarify for everyone since there is confusion apparently:

@Moritz90 @clayk - the git+git@host syntax is the same thing as using git+ssh://git@host -- pip itself does a drop in of ssh:// and we do this as well, this is the piece of code that currently is broken when you actually do use the more verbose format.

@hcoura your issue is unrelated, you are not using the correct syntax. You are using git+git@github.com/my/package.git and you need to be using a : instead of a /: git+git@github.com:my/package.git

@hcoura
Copy link

hcoura commented Mar 6, 2018

@techalchemy I guess I wasn't explicit as I was using:

pipenv install -e git+ssh://git@github.com/my/package

Anyway, I did some more testing here(python 2.7.14 btw) and:

  • pipenv install -e git+ssh://git@github.com/my/package.git@v1.0.0#egg=my_package

Install package but Lock fails, last message:

pip.exceptions.InstallationError: Command "git clone -q git@github.com/orchardmile/data-acquisition-core.git /tmp/pip-ri964xm6-export" failed with error code 128 in None

adds this line to Pipfile:

my_package = {git = "git@github.com/my/package.git.git", editable = true, ref = "v1.0.0"}
  • pipenv install -e git+ssh://git@github.com/my/package.git@v1.0.0#egg=my_package

Install package but Lock fails, last message:

pip.exceptions.InstallationError: Command "git clone -q git@github.com/my/package.git /tmp/pip-ri964xm6-export" failed with error code 128 in None

adds this line to Pipfile:

my_package = {git = "git@github.com/my/package.git.git", editable = true, ref = "v1.0.0"}
  • git+git@github.com:my/package.git@v1.0.0#egg=my_package

Installs fine and adds this line to Pipfile:

my_package = {git = "git@github.com:my/package.git.git", editable = true, ref = "v1.0.0"}

and everything works fine

@techalchemy
Copy link
Member

Fixed in master, feel free to try it out and let me know if you continue to have issues

@Moritz90
Copy link

Moritz90 commented Mar 7, 2018

11.1.0 works for me! Thank you for the quick fix!

@safijari
Copy link

safijari commented Mar 8, 2018

It was quite perplexing when I realized that this error was happening on my laptop but not on a fresh test VM ... thank you for the fix :)

@jamesstidard
Copy link
Contributor

I'm still having a problem trying to make pipenv install from a private repository over ssh. I may have misunderstood the thread above so forgive me.

I'm currently trying to use pipenv install -e git+git@github.com:username/repo.git#egg=project which succeeds, but on actually installation I get prompted for a username and password, which seems to me like it's using https instead of ssh.

@techalchemy
Copy link
Member

@jamesstidard it’s hard to troubleshoot a problem when you say you’ve done things right but it’s not working — please open an issue and provide logs

@araichev
Copy link

I'm also getting errors trying to install a Python package from a private (Gitlab) Git repository using Pipenv.

Describe your environment

  • Linux Mint 18.3
  • Python 3.5.2
  • Pipenv version 2018.05.18

Expected result

I expected the package to install and the lockfile to be written.

Actual result

Without the -e flag:

araichev@wujarch~/tmp> pipenv install git+git@gitlab.com:mrcagney/aee.git#egg=aee
Installing git+git@gitlab.com:mrcagney/aee.git#egg=aee…
⠦Warning: You installed a VCS dependency in non–editable mode. This will work fine, but sub-dependencies will not be resolved by $ pipenv lock.
  To enable this sub–dependency functionality, specify that this dependency is editable.

Error:  An error occurred while installing git+git@gitlab.com:mrcagney/aee.git#egg=aee!
Invalid requirement: 'git+git@gitlab.com:mrcagney/aee.git#egg=aee'
It looks like a path. File 'git+git@gitlab.com:mrcagney/aee.git#egg=aee' does not exist.

With the -e flag:

araichev@wujarch~/tmp> pipenv install -e git+git@gitlab.com:mrcagney/aee.git#egg=aee
Installing -e git+git@gitlab.com:mrcagney/aee.git#egg=aee…
Obtaining aee from git+git@gitlab.com:mrcagney/aee.git#egg=aee
  Cloning git@gitlab.com:mrcagney/aee.git to /home/araichev/.virtualenvs/tmp-1_pz9ZUR/src/aee
Collecting pandas>=0.20.0 (from aee)
  Downloading https://files.pythonhosted.org/packages/a5/c1/43966a4ce89d0c64111f46c6364ed57d6d87e6fab7d685dca06197a19cf7/pandas-0.23.0-cp35-cp35m-manylinux1_x86_64.whl (11.6MB)
Collecting wrapt>=1.10.11 (from aee)
Collecting voluptuous>=0.11.1 (from aee)
  Using cached https://files.pythonhosted.org/packages/f5/09/a0e20a0bd743131e237128bad3a4f83b283f70c032b7e7c0f06baf7f6862/voluptuous-0.11.1-py2.py3-none-any.whl
Collecting numpy>=1.9.0 (from pandas>=0.20.0->aee)
  Using cached https://files.pythonhosted.org/packages/7b/61/11b05cc37ccdaabad89f04dbdc2a02905cf6de6f9b05816dba843beed328/numpy-1.14.3-cp35-cp35m-manylinux1_x86_64.whl
Collecting python-dateutil>=2.5.0 (from pandas>=0.20.0->aee)
  Using cached https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl
Collecting pytz>=2011k (from pandas>=0.20.0->aee)
  Using cached https://files.pythonhosted.org/packages/dc/83/15f7833b70d3e067ca91467ca245bae0f6fe56ddc7451aa0dc5606b120f2/pytz-2018.4-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil>=2.5.0->pandas>=0.20.0->aee)
  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Installing collected packages: numpy, six, python-dateutil, pytz, pandas, wrapt, voluptuous, aee
  Running setup.py develop for aee
Successfully installed aee numpy-1.14.3 pandas-0.23.0 python-dateutil-2.7.3 pytz-2018.4 six-1.11.0 voluptuous-0.11.1 wrapt-1.10.11

Adding -e git+git@gitlab.com:mrcagney/aee.git#egg=aee to Pipfile's [packages]…
Installing -e git+git@gitlab.com:mrcagney/aee.git#egg=aee…
Obtaining aee from git+git@gitlab.com:mrcagney/aee.git#egg=aee
  Updating /home/araichev/.virtualenvs/tmp-1_pz9ZUR/src/aee clone
Requirement already satisfied: pandas>=0.20.0 in /home/araichev/.virtualenvs/tmp-1_pz9ZUR/lib/python3.5/site-packages (from aee) (0.23.0)
Requirement already satisfied: wrapt>=1.10.11 in /home/araichev/.virtualenvs/tmp-1_pz9ZUR/lib/python3.5/site-packages (from aee) (1.10.11)
Requirement already satisfied: voluptuous>=0.11.1 in /home/araichev/.virtualenvs/tmp-1_pz9ZUR/lib/python3.5/site-packages (from aee) (0.11.1)
Requirement already satisfied: numpy>=1.9.0 in /home/araichev/.virtualenvs/tmp-1_pz9ZUR/lib/python3.5/site-packages (from pandas>=0.20.0->aee) (1.14.3)
Requirement already satisfied: pytz>=2011k in /home/araichev/.virtualenvs/tmp-1_pz9ZUR/lib/python3.5/site-packages (from pandas>=0.20.0->aee) (2018.4)
Requirement already satisfied: python-dateutil>=2.5.0 in /home/araichev/.virtualenvs/tmp-1_pz9ZUR/lib/python3.5/site-packages (from pandas>=0.20.0->aee) (2.7.3)
Requirement already satisfied: six>=1.5 in /home/araichev/.virtualenvs/tmp-1_pz9ZUR/lib/python3.5/site-packages (from python-dateutil>=2.5.0->pandas>=0.20.0->aee) (1.11.0)
Installing collected packages: aee
  Found existing installation: aee 2.8.0
    Uninstalling aee-2.8.0:
      Successfully uninstalled aee-2.8.0
  Running setup.py develop for aee
Successfully installed aee

Adding -e git+git@gitlab.com:mrcagney/aee.git#egg=aee to Pipfile's [packages]…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
cies(best_match):
  File "/usr/local/lib/python3.5/dist-packages/pipenv/patched/piptools/resolver.py", line 275, in _iter_dependencies
    for dependency in self.repository.get_dependencies(ireq):
  File "/usr/local/lib/python3.5/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 202, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "/usr/local/lib/python3.5/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 221, in get_legacy_dependencies
    dist = ireq.get_dist()
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/pip9/req/req_install.py", line 1069, in get_dist
    egg_info = self.egg_info_path('').rstrip('/')
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/pip9/req/req_install.py", line 515, in egg_info_path
    'No files/directories in %s (from %s)' % (base, filename)
pip9.exceptions.InstallationError: No files/directories in None (from )

@wvxvw
Copy link

wvxvw commented Jun 3, 2018

To be sure, this is an error in some newer version of Pipenv. The same Pipfile worked before updating to 2018.05.18 whatever that means.

The error I'm getting is:

Traceback (most recent call last):
  File "/home/olegs/.local/share/virtualenvs/fx-flow-n4Qx23Bo/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py", line 93, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/home/olegs/.local/share/virtualenvs/fx-flow-n4Qx23Bo/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1632, in parseString
    raise exc
  File "/home/olegs/.local/share/virtualenvs/fx-flow-n4Qx23Bo/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1622, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "/home/olegs/.local/share/virtualenvs/fx-flow-n4Qx23Bo/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/olegs/.local/share/virtualenvs/fx-flow-n4Qx23Bo/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 3395, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/home/olegs/.local/share/virtualenvs/fx-flow-n4Qx23Bo/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1383, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/olegs/.local/share/virtualenvs/fx-flow-n4Qx23Bo/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 3183, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pip._vendor.pyparsing.ParseException: Expected stringEnd (at char 3), (line:1, col:4)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/olegs/.local/share/virtualenvs/fx-flow-n4Qx23Bo/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 252, in from_line
    req = Requirement(req)
  File "/home/olegs/.local/share/virtualenvs/fx-flow-n4Qx23Bo/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py", line 97, in __init__
    requirement_string[e.loc:e.loc + 8]))
pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'+git@git'"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/olegs/.local/share/virtualenvs/fx-flow-n4Qx23Bo/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
    status = self.run(options, args)
  File "/home/olegs/.local/share/virtualenvs/fx-flow-n4Qx23Bo/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 267, in run
    self.name, wheel_cache
  File "/home/olegs/.local/share/virtualenvs/fx-flow-n4Qx23Bo/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 296, in populate_requirement_set
    wheel_cache=wheel_cache
  File "/home/olegs/.local/share/virtualenvs/fx-flow-n4Qx23Bo/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 262, in from_line
    "Invalid requirement: '%s'\n%s" % (req, add_msg))
pip._internal.exceptions.InstallationError: Invalid requirement: 'git+git@github.com:somewhere.git@HEAD#egg=some-package'
It looks like a path. File 'git+git@github.com:somewhere.git@HEAD#egg=some-package' does not exist.

Invalid requirement: 'git+git@github.com:somewhere.git@HEAD#egg=some-package'
It looks like a path. File 'git+git@github.com:somewhere.git@HEAD#egg=some-package' does not exist.

Now, when I start virtual environment shell and execute there:

pip install -e 'git+git@github.com:somewhere.git@HEAD#egg=some-package'

pip installs the package.

To reflect on the error:

pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'+git@git'"

is a lie. This is not an invalid requirement. This is you failing to parse a valid requirement.
2. To others who suggested that it should be something else, like ssh+git@... or ssh://... and so on: no. It shouldn't. This is a supported scheme, it doesn't mean the same as ssh:// one. In fact, it's a different protocol, completely independent of SSH.

@techalchemy
Copy link
Member

git+git uses ssh on the backend. git:// is indeed a different protocol but is mostly deprecated although still usable. Either way this is working in the release if you don’t use quotes (mainly because we don’t treat -e as a cli flag). We can take a look at stripping those too, shouldn’t be too bad.

Kind of strange to accuse an unhandled exception of lying. The exception told you what it had a problem with. Still, this feel like a step in the right direction so I’ll look at it as a positive.

@thekashifmalik
Copy link

This error is still present on the latest version of pipenv on brew. Seeing it on pipenv, version 2018.05.18

Could not detect requirement name

Even though the egg name is present in the source file.

@uranusjr
Copy link
Member

uranusjr commented Jun 7, 2018

@thekashifmalik Please be more constructive. You say it like it’s obvious and simple—why not try extracting this information yourself :)

@thekashifmalik
Copy link

@uranusjr What?

Is there other information you would like me to include?

pipenv is having trouble parsing/installing this requirement from a requirements.txt I'm trying to convert to a Pipfile.

The requirement: -e git+http://phabricator.XXX.net/diffusion/XXX/PACKAGENAME.git@0b0bca20f2a75e37633043c96871d25d328af973#egg=PACKAGENAME (names obfuscated)

The command used was pipenv install -r requirements.txt.

The error:

Could not detect requirement name for 'git+http://phabricator.local.XXX.net/diffusion/XXX/PACKAGENAME.git@0b0bca20f2a75e37633043c96871d25d328af973', please specify one with #egg=your_package_name

@uranusjr
Copy link
Member

uranusjr commented Jun 7, 2018

I mean, maybe put this in the form of a pull request? Code in GitHub issues doesn’t run as part of Pipenv.

@thekashifmalik
Copy link

@uranusjr I'm not sure I follow.

I'm suggesting that this Github issue (Unable to install package from private repository) is not resolved on the latest stable version of pipenv and so let's re-open it and solve the problem.

@thekashifmalik
Copy link

Multiple people above have also reported this. Can we re-open this issue? Is it solved on master and we just need a new PyPI release?

@techalchemy
Copy link
Member

This issue is quite old and was reported specifically about ssh:// prefixed requirements, so is not related to general case vcs requirements. It was fixed when it was closed in the first place.

As to your specific issue, you should check closed issues if possible, we have made a lot of changes and it's hard to remember offhand which ones were done since the last release. Alternatively, you can grab the latest version of pipenv from here and see if your requirements.txt file parses correctly

@grudelsud
Copy link

grudelsud commented Aug 24, 2018

hi all, I seem to have the same problem installing from a private repo with sources, and after reading this thread a few times it's not clear to me if there's any solution or workaround. here's the problem I have, starting from an empty pipfile

pipenv install -e git+git@github.server.com:org/dataround.git#egg=dataround

shows the error in console

pipenv.patched.notpip._internal.exceptions.InstallationError: Command "git clone -q ssh://git@github.server.com:org/dataround.git /var/folders/dg/ty_jfr9j40d9l0zw4gzn5x_h0000gn/T/tmpwj0_whscsource/dataround" failed with error code 128 in None

(basically having a : before the organisation name instead of a /) still it correctly installs the packages and generates the line dataround = {editable = true, git = "git@github.server.com:org/dataround.git"} in the Pipenv file

if I then

pipenv --rm
pipenv install

I have the same installation error as reported above and no package is installed (i.e. pipenv graph is completely empty).

I'm using python 3.6.5 with pip 18.0 and pipenv version 2018.7.1. Any help would be greatly appreciated.

@techalchemy
Copy link
Member

Yes, we have a fix in master but have not released it -- we have been bogged down with a few other issues, many apologies. If you want to confirm that the fix in the master branch works for you, that would be much appreciated!

@grudelsud
Copy link

@techalchemy thanks for feedback. I'm not sure I've done this the right way, but I've installed pipenv from git, i.e. pip3 install git+git://github.com/pypa/pipenv.git so that a pip freeze now reports pipenv==2018.7.1.dev0 (correctly matching version on master) then installed my private repo with sources, and still seeing the same error:

Locking [packages] dependencies…
[full stack trace omitted here]
pipenv.patched.notpip._internal.exceptions.InstallationError: Command "git clone -q ssh://git@github.server.com:org/dataround.git /var/folders/dg/ty_jfr9j40d9l0zw4gzn5x_h0000gn/T/tmp8dlrr0zfsource/dataround" failed with error code 128 in None

should I try something different instead?

@thehesiod
Copy link

getting same issue as @grudelsud with master version of pipenv

@techalchemy
Copy link
Member

Ah yes, I can confirm this is an issue on master, I need to dig into what is going on here

@techalchemy techalchemy reopened this Sep 23, 2018
@cspencer
Copy link

I was having the same issue described; reverting to version 11.10.4 allowed me to install the git package.

@DataGreed
Copy link

Sam problem here

techalchemy added a commit that referenced this issue Oct 8, 2018
- Fixes #1393

Signed-off-by: Dan Ryan <dan@danryan.co>
@miroli
Copy link

miroli commented May 29, 2019

I realize this issue is closed, but I have the exact same problem as @grudelsud (failed with error code 128 in None) and I'm on the latest version of pipenv. Not sure if a fix was deployed?

@goharattiq
Copy link

@techalchemy have we fixed the issue related to installing from the private GitHub repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests