Skip to content

Editable packages with markers can not be locked #2902

@jxltom

Description

@jxltom
Issue description

In Pipfile, if markers are added for an editable package, latest pipenv in master branch can not lock.

In some older version of Pipenv, even editable packages can be locked, the generated requirements.txt such as -e git+https://github.com/PyCQA/pylint.git@8682a220911a9c22286089e08f7e77b7b15d990b#egg=pylint; python_version >= '3.4' can not be installed by pip. And extra space before markers ; for installing by pip install -r requirements.txt is required such as -e git+https://github.com/PyCQA/pylint.git@8682a220911a9c22286089e08f7e77b7b15d990b#egg=pylint ; python_version >= '3.4'

Expected result

pipenv lock should work.

Actual result

Following error will be raised.

Locking [dev-packages] dependencies…
Locking [packages] dependencies…
pip/_vendor/packaging/requirements.py", line 97, in __init__
    requirement_string[e.loc:e.loc + 8]))
pipenv.patched.notpip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "';'"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/Documents/dev/pipenv/pipenv/resolver.py", line 101, in <module>
    main()
  File "/home/user/Documents/dev/pipenv/pipenv/resolver.py", line 90, in main
    system=system,
  File "/home/user/Documents/dev/pipenv/pipenv/resolver.py", line 73, in resolve
    allow_global=system,
  File "/home/user/Documents/dev/pipenv/pipenv/utils.py", line 424, in resolve_deps
    req_dir=req_dir,
  File "/home/user/Documents/dev/pipenv/pipenv/utils.py", line 295, in actually_resolve_deps
    constraints = [c for c in constraints]
  File "/home/user/Documents/dev/pipenv/pipenv/utils.py", line 295, in <listcomp>
    constraints = [c for c in constraints]
  File "/home/user/Documents/dev/pipenv/pipenv/patched/notpip/_internal/req/req_file.py", line 89, in parse_requirements
    for req in req_iter:
  File "/home/user/Documents/dev/pipenv/pipenv/patched/notpip/_internal/req/req_file.py", line 164, in process_line
    constraint=constraint, isolated=isolated, wheel_cache=wheel_cache
  File "/home/user/Documents/dev/pipenv/pipenv/patched/notpip/_internal/req/req_install.py", line 147, in from_editable
    raise InstallationError("Invalid requirement: '%s'" % name)
pipenv.patched.notpip._internal.exceptions.InstallationError: Invalid requirement: 'pylint;'
Steps to replicate
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
pylint = {git = "https://github.com/PyCQA/pylint.git", editable = true, ref = "2.1.1", markers = "python_version >= '3.4'"}

pipenv lock --clear for above Pipfile will raise error.


$ pipenv --support

Pipenv version: '2018.7.1.dev0'

Pipenv location: '/home/user/Documents/dev/pipenv/pipenv'

Python location: '/usr/bin/python'

Python installations found:

  • 3.6.6: /home/user/.pyenv/shims/python3.6
  • 3.5.2: /home/user/.pyenv/shims/python3.5m
  • 3.5.2: /home/user/.pyenv/shims/python3
  • 3.5.2: /home/user/.pyenv/shims/python3.5
  • 3.5.2: /usr/bin/python3.5
  • 2.7.12: /home/user/.pyenv/shims/python2
  • 3.6.6: /home/user/.pyenv/shims/python3.6m
  • 3.5.2: /usr/bin/python3.5m
  • 2.7.12: /home/user/.pyenv/shims/python2.7
  • 2.7.12: /home/user/.pyenv/shims/python
  • 2.7.12: /usr/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '0',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.15.0-34-generic',
 'platform_system': 'Linux',
 'platform_version': '#37~16.04.1-Ubuntu SMP Tue Aug 28 10:44:06 UTC 2018',
 'python_full_version': '2.7.12',
 'python_version': '2.7',
 'sys_platform': 'linux2'}

System environment variables:

  • LESS
  • UPSTART_EVENTS
  • PYTHONDONTWRITEBYTECODE
  • XDG_SESSION_TYPE
  • LC_PAPER
  • SHELL
  • PYENV_SHELL
  • XDG_DATA_DIRS
  • MANDATORY_PATH
  • COMPIZ_CONFIG_PROFILE
  • UNITY_DEFAULT_PROFILE
  • UPSTART_INSTANCE
  • JOB
  • XMODIFIERS
  • JAVA_HOME
  • GTK2_MODULES
  • XDG_RUNTIME_DIR
  • LC_ADDRESS
  • LC_CTYPE
  • QT_ACCESSIBILITY
  • DBUS_STARTER_BUS_TYPE
  • XDG_SESSION_ID
  • DBUS_SESSION_BUS_ADDRESS
  • DEFAULTS_PATH
  • DESKTOP_SESSION
  • GTK_MODULES
  • INSTANCE
  • LC_NAME
  • XDG_MENU_PREFIX
  • LS_COLORS
  • GOPATH
  • DBUS_STARTER_ADDRESS
  • GNOME_DESKTOP_SESSION_ID
  • XDG_CURRENT_DESKTOP
  • USER
  • XDG_VTNR
  • PYENV_VIRTUALENV_INIT
  • XAUTHORITY
  • LANGUAGE
  • SESSION_MANAGER
  • LC_MEASUREMENT
  • QT_QPA_PLATFORMTHEME
  • CLUTTER_IM_MODULE
  • WINDOWID
  • GPG_AGENT_INFO
  • LANG
  • GDMSESSION
  • UPSTART_JOB
  • XDG_SEAT_PATH
  • PIP_PYTHON_PATH
  • _
  • GTK_IM_MODULE
  • XDG_CONFIG_DIRS
  • HTTP_PROXY
  • QT_VERSION
  • LC_TIME
  • PAGER
  • XDG_GREETER_DATA_DIR
  • QT4_IM_MODULE
  • HOME
  • DISPLAY
  • XDG_SESSION_DESKTOP
  • QT_DIR
  • CONDA_SHLVL
  • LC_MONETARY
  • QT_LINUX_ACCESSIBILITY_ALWAYS_ON
  • LC_IDENTIFICATION
  • VTE_VERSION
  • UPSTART_SESSION
  • GNOME_KEYRING_PID
  • HTTPS_PROXY
  • LC_NUMERIC
  • UNITY_HAS_3D_SUPPORT
  • QT_IM_MODULE
  • LOGNAME
  • XDG_SEAT
  • GNOME_KEYRING_CONTROL
  • PATH
  • ZSH
  • TERM
  • XDG_SESSION_PATH
  • DBUS_DEBUG_OUTPUT
  • SESSIONTYPE
  • IM_CONFIG_PHASE
  • SSH_AUTH_SOCK
  • LSCOLORS
  • OLDPWD
  • GDM_LANG
  • LC_TELEPHONE
  • SHLVL
  • PWD

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/user/.pyenv/plugins/pyenv-virtualenv/shims:/home/user/.pyenv/shims:/home/user/.pyenv/bin:/home/user/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/home/user/go/bin:/home/user/jdk1.8.0_171/bin:/home/user/apache-maven-3.5.3/bin
  • SHELL: /usr/bin/zsh
  • LANG: en_US.UTF-8
  • PWD: /home/user/Documents/dev/test-python-package-management/pipenv-semicolon-in-editable-package

Contents of Pipfile ('/home/user/Documents/dev/test-python-package-management/pipenv-semicolon-in-editable-package/Pipfile'):

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

[packages]
pylint = {git = "https://github.com/PyCQA/pylint.git", editable = true, ref = "2.1.1", markers = "python_version >= '3.4'"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions