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

Trouble installing editable packages from git repos #1866

Closed
drcongo opened this issue Mar 28, 2018 · 2 comments
Closed

Trouble installing editable packages from git repos #1866

drcongo opened this issue Mar 28, 2018 · 2 comments

Comments

@drcongo
Copy link

drcongo commented Mar 28, 2018

Issue

I'm having trouble getting pipenv to deal with editable installs from git. I've narrowed down as much as possible for the purposes of this test. There's a repo here with the whole thing for reproducing.

This is the three line requirements.txt I'm using - each line has a slightly different, but apparently valid url scheme. Installing this with pip works fine.

-e git+http://github.com/hactar-is/django-admin-list-filter-dropdown.git@1a5e6040dfeca6b09317401f5bd7a518141c9433#egg=django_admin_list_filter_dropdown
-e git+git@codebasehq.com:hactar/hactar-library/wagtail_eventbrite.git@90bdfc680fc920eed8618d29aefac770d258c359#egg=wagtail_eventbrite
-e git://github.com/miracle2k/webassets.git@cc440911c6ac5f08fd98ea08442fe06e7a0aea2a#egg=webassets

When I run pipenv install I get this output:

requirements.txt found, instead of Pipfile! Converting…
Warning: Your Pipfile now contains pinned versions, if your requirements.txt did.
We recommend updating your Pipfile to specify the "*" version, instead.
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
nv/utils.py", line 285, in actually_resolve_reps
    dep[len('-e '):]
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/pip9/req/req_install.py", line 144, in from_editable
    editable_req, default_vcs)
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/pip9/req/req_install.py", line 1197, in parse_editable
    "Could not detect requirement name, please specify one with #egg="
pip9.exceptions.InstallationError: Could not detect requirement name, please specify one with #egg=

Obviously the Pipfile.lock doesn't get created but the Pipfile does, and that contains this...

[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[dev-packages]

[requires]
python_version = "3.5"

[packages]
"4c58dfa" = {path = "git+http://github.com/hactar-is/django-admin-list-filter-dropdown.git@1a5e6040dfeca6b09317401f5bd7a518141c9433", editable = true}
wagtail_eventbrite = {ref = "90bdfc680fc920eed8618d29aefac770d258c359", editable = true, git = "git@codebasehq.com:hactar/hactar-library/wagtail_eventbrite.git"}
webassets = {ref = "cc440911c6ac5f08fd98ea08442fe06e7a0aea2a", editable = true, git = "git://github.com/miracle2k/webassets.git"}

All the #egg= bits have been removed. So I try manually adding them to the Pipfile, relevant lines now look like this:

"4c58dfa" = {path = "git+http://github.com/hactar-is/django-admin-list-filter-dropdown.git@1a5e6040dfeca6b09317401f5bd7a518141c9433#egg=django_admin_list_filter_dropdown", editable = true}
wagtail_eventbrite = {ref = "90bdfc680fc920eed8618d29aefac770d258c359", editable = true, git = "git@codebasehq.com:hactar/hactar-library/wagtail_eventbrite.git#egg=wagtail_eventbrite"}
webassets = {ref = "cc440911c6ac5f08fd98ea08442fe06e7a0aea2a", editable = true, git = "git://github.com/miracle2k/webassets.git#egg=webassets"}

pipenv lock produces this:

Locking [dev-packages] dependencies…
Locking [packages] dependencies…
ges/pipenv/resolver.py", line 63, in resolve
    verbose=verbose,
  File "/vagrant/test2/venv3/lib/python3.5/site-packages/pipenv/utils.py", line 425, in resolve_deps
    pre,
  File "/vagrant/test2/venv3/lib/python3.5/site-packages/pipenv/utils.py", line 285, in actually_resolve_reps
    dep[len('-e '):]
  File "/vagrant/test2/venv3/lib/python3.5/site-packages/pipenv/vendor/pip9/req/req_install.py", line 156, in from_editable
    wheel_cache=wheel_cache)
  File "/vagrant/test2/venv3/lib/python3.5/site-packages/pipenv/vendor/pip9/req/req_install.py", line 91, in __init__
    "Invalid requirement: '%s'\n%s" % (req, add_msg))
pip9.exceptions.InstallationError: Invalid requirement: 'wagtail_eventbrite@90bdfc680fc920eed8618d29aefac770d258c359#egg=wagtail_eventbrite'
= is not a valid operator. Did you mean == ?

If I try the lines one at a time pipenv lock on just the django_admin_list_filter_dropdown package produces:

Locking [dev-packages] dependencies…
Locking [packages] dependencies…
encies(best_match):
  File "/vagrant/test2/venv3/lib/python3.5/site-packages/pipenv/patched/piptools/resolver.py", line 275, in _iter_dependencies
    for dependency in self.repository.get_dependencies(ireq):
  File "/vagrant/test2/venv3/lib/python3.5/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 174, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "/vagrant/test2/venv3/lib/python3.5/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 193, in get_legacy_dependencies
    dist = ireq.get_dist()
  File "/vagrant/test2/venv3/lib/python3.5/site-packages/pipenv/vendor/pip9/req/req_install.py", line 1069, in get_dist
    egg_info = self.egg_info_path('').rstrip('/')
  File "/vagrant/test2/venv3/lib/python3.5/site-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 )

The other two both produce the same(ish) error:

Locking [dev-packages] dependencies…
Locking [packages] dependencies…
ges/pipenv/resolver.py", line 63, in resolve
    verbose=verbose,
  File "/vagrant/test2/venv3/lib/python3.5/site-packages/pipenv/utils.py", line 425, in resolve_deps
    pre,
  File "/vagrant/test2/venv3/lib/python3.5/site-packages/pipenv/utils.py", line 285, in actually_resolve_reps
    dep[len('-e '):]
  File "/vagrant/test2/venv3/lib/python3.5/site-packages/pipenv/vendor/pip9/req/req_install.py", line 156, in from_editable
    wheel_cache=wheel_cache)
  File "/vagrant/test2/venv3/lib/python3.5/site-packages/pipenv/vendor/pip9/req/req_install.py", line 91, in __init__
    "Invalid requirement: '%s'\n%s" % (req, add_msg))
pip9.exceptions.InstallationError: Invalid requirement: 'wagtail_eventbrite@90bdfc680fc920eed8618d29aefac770d258c359#egg=wagtail_eventbrite'
= is not a valid operator. Did you mean == ?

I don't really understand what I'm doing wrong.

$ python -m pipenv.help output (as run from the venv3 pipenv)

Pipenv version: '11.9.0'

Pipenv location: '/vagrant/test2/venv3/lib/python3.5/site-packages/pipenv'

Python location: '/vagrant/test2/venv3/bin/python'

Other Python installations in PATH:

  • 2.7: /usr/bin/python2.7

  • 2.7: /usr/bin/python2.7

  • 3.5: /usr/bin/python3.5m

  • 3.5: /vagrant/test2/venv3/bin/python3.5

  • 3.5: /usr/bin/python3.5

  • 3.5.2: /vagrant/test2/venv3/bin/python

  • 2.7.12: /usr/bin/python

  • 2.7.12: /usr/bin/python2

  • 3.5.2: /vagrant/test2/venv3/bin/python3

  • 3.5.2: /usr/bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.5.2',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.4.0-87-generic',
 'platform_system': 'Linux',
 'platform_version': '#110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017',
 'python_full_version': '3.5.2',
 'python_version': '3.5',
 'sys_platform': 'linux'}

System environment variables:

  • LESSCLOSE
  • VIRTUAL_ENV
  • USER
  • SSH_AUTH_SOCK
  • SSH_TTY
  • SHLVL
  • PYTHONUNBUFFERED
  • LS_COLORS
  • TERM
  • LANG
  • OLDPWD
  • SSH_CLIENT
  • _
  • PS1
  • SSH_CONNECTION
  • LC_CTYPE
  • XDG_RUNTIME_DIR
  • XDG_SESSION_ID
  • LANGUAGE
  • PIP_PYTHON_PATH
  • LESSOPEN
  • PYTHONDONTWRITEBYTECODE
  • PATH
  • SHELL
  • MAIL
  • PWD
  • HOME
  • LOGNAME

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /vagrant/test2/venv3/bin:/home/vagrant/bin:/home/vagrant/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /vagrant/test2
  • VIRTUAL_ENV: /vagrant/test2/venv3

Contents of Pipfile ('/vagrant/test2/Pipfile'):

[[source]]
name = "pypi"
verify_ssl = true
url = "https://pypi.python.org/simple"

[requires]
python_version = "3.5"

[dev-packages]

[packages]
"4c58dfa" = {path = "git+http://github.com/hactar-is/django-admin-list-filter-dropdown.git@1a5e6040dfeca6b09317401f5bd7a518141c9433", editable = true}
wagtail_eventbrite = {editable = true, git = "git@codebasehq.com:hactar/hactar-library/wagtail_eventbrite.git", ref = "90bdfc680fc920eed8618d29aefac770d258c359"}
webassets = {editable = true, git = "git://github.com/miracle2k/webassets.git", ref = "cc440911c6ac5f08fd98ea08442fe06e7a0aea2a"}
$ python -m pipenv.help output (called outside a venv with `python3 -m pipenv.help`

Pipenv version: '11.9.0'

Pipenv location: '/usr/local/lib/python3.5/dist-packages/pipenv'

Python location: '/usr/bin/python3'

Other Python installations in PATH:

  • 2.7: /usr/bin/python2.7

  • 2.7: /usr/bin/python2.7

  • 3.5: /usr/bin/python3.5m

  • 3.5: /usr/bin/python3.5

  • 2.7.12: /usr/bin/python

  • 2.7.12: /usr/bin/python2

  • 3.5.2: /usr/bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.5.2',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.4.0-87-generic',
 'platform_system': 'Linux',
 'platform_version': '#110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017',
 'python_full_version': '3.5.2',
 'python_version': '3.5',
 'sys_platform': 'linux'}

System environment variables:

  • LOGNAME
  • SHELL
  • LS_COLORS
  • _
  • TERM
  • LESSCLOSE
  • LANG
  • SSH_AUTH_SOCK
  • PATH
  • USER
  • SSH_CONNECTION
  • PS1
  • OLDPWD
  • SSH_CLIENT
  • LESSOPEN
  • LANGUAGE
  • PYTHONDONTWRITEBYTECODE
  • SSH_TTY
  • PWD
  • LC_CTYPE
  • MAIL
  • XDG_RUNTIME_DIR
  • SHLVL
  • XDG_SESSION_ID
  • PYTHONUNBUFFERED
  • PIP_PYTHON_PATH
  • HOME

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/vagrant/bin:/home/vagrant/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /vagrant/test1

Contents of Pipfile ('/vagrant/test1/Pipfile'):

[[source]]
name = "pypi"
url = "https://pypi.python.org/simple"
verify_ssl = true

[requires]
python_version = "3.5"

[packages]
"4c58dfa" = {editable = true, path = "git+http://github.com/hactar-is/django-admin-list-filter-dropdown.git@1a5e6040dfeca6b09317401f5bd7a518141c9433"}
wagtail_eventbrite = {git = "git@codebasehq.com:hactar/hactar-library/wagtail_eventbrite.git", editable = true, ref = "90bdfc680fc920eed8618d29aefac770d258c359"}
webassets = {git = "git://github.com/miracle2k/webassets.git", editable = true, ref = "cc440911c6ac5f08fd98ea08442fe06e7a0aea2a"}

[dev-packages]

Expected result

I expected it to install the dependencies and create valid working lines in the Pipfile.

Actual result

It created lines in the Pipfile that cause pipenv lock to break.

Steps to replicate

You can re-create it exactly using the vagrant VM in this repo.

@frostming
Copy link
Contributor

frostming commented Mar 29, 2018

For the first dep, you can replace http by https and that produces

"django_admin_list_filter_dropdown" = {path = "git+https://github.com/hactar-is/django-admin-list-filter-dropdown.git", ref="1a5e6040dfeca6b09317401f5bd7a518141c9433", editable = true}

Secondly, you shouldn't add #egg to the tail of URL. egg part is parsed as package name and removed from the URI.

@techalchemy
Copy link
Member

@drcongo adding the #egg= to the path itself won't help you, it gets translated to the name of the package in your pipfile:

[packages]
"4c58dfa" = {path = "git+http://github.com/hactar-is/django-admin-list-filter-dropdown.git@1a5e6040dfeca6b09317401f5bd7a518141c9433", editable = true}

So I can see right away that it's this particular path which as @frostming pointed out, didn't translate properly. If you used git+https as he mentions the name and ref would be picked up. git+http:// isn't a valid URL scheme, you need to use https -- and then yes, you can parse out the ref and the name as he already mentioned and your entry will work fine

This issue was closed.
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

3 participants