Repository: pypa/pipenv

Issue:
Error installing package with sys_platform marker 
When a package listed in the `Pipfile` has a `sys_platform` marker, it fails to install with the following error:

```
pip._vendor.packaging.markers.InvalidMarker: Invalid marker: 'sys_platform == linux', parse error at 'linux'
```

<details><summary>$ python -m pipenv.help output</summary>

Pipenv version: `'2018.6.25'`

Pipenv location: `'/Users/robgolding/src/zapier/tp/.venv/lib/python3.6/site-packages/pipenv'`

Python location: `'/Users/robgolding/src/zapier/tp/.venv/bin/python'`

Other Python installations in `PATH`:

  - `2.7`: `/Users/robgolding/.pyenv/shims/python2.7`
  - `2.7`: `/Users/robgolding/.pyenv/shims/python2.7`
  - `2.7`: `/Users/robgolding/.pyenv/shims/python2.7`
  - `2.7`: `/usr/bin/python2.7`
  - `3.6`: `/usr/local/bin/python3.6m`
  - `3.6`: `/Users/robgolding/src/zapier/tp/.venv/bin/python3.6`
  - `3.6`: `/Users/robgolding/.pyenv/shims/python3.6`
  - `3.6`: `/usr/local/bin/python3.6`
  - `3.6`: `/Users/robgolding/.pyenv/shims/python3.6`

  - `3.6.5`: `/Users/robgolding/src/zapier/tp/.venv/bin/python`
  - `2.7.14`: `/Users/robgolding/.pyenv/shims/python`
  - `2.7.14`: `/Users/robgolding/.pyenv/shims/python`
  - `2.7.10`: `/usr/bin/python`
  - `2.7.14`: `/Users/robgolding/.pyenv/shims/python2`
  - `2.7.14`: `/Users/robgolding/.pyenv/shims/python2`
  - `3.6.5`: `/Users/robgolding/src/zapier/tp/.venv/bin/python3`
  - `None`: `/Users/robgolding/.pyenv/shims/python3`
  - `3.6.5`: `/usr/local/bin/python3`
  - `None`: `/Users/robgolding/.pyenv/shims/python3`

PEP 508 Information:

```
{'implementation_name': 'cpython',
 'implementation_version': '3.6.5',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '17.6.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 17.6.0: Tue May  8 15:22:16 PDT '
                     '2018; root:xnu-4570.61.1~1/RELEASE_X86_64',
 'python_full_version': '3.6.5',
 'python_version': '3.6',
 'sys_platform': 'darwin'}
```

System environment variables:

  - `PATH`
  - `scmbDir`
  - `GREP_COLOR`
  - `LESS_TERMCAP_mb`
  - `TERM_PROGRAM`
  - `LESS_TERMCAP_md`
  - `NVM_CD_FLAGS`
  - `LESS_TERMCAP_me`
  - `TERM`
  - `SHELL`
  - `DRONE_TOKEN_STAGING`
  - `CLICOLOR`
  - `TMPDIR`
  - `PIPENV_VENV_IN_PROJECT`
  - `K8S_SERVER_PRODUCTION`
  - `ga_auto_remove`
  - `Apple_PubSub_Socket_Render`
  - `TERM_PROGRAM_VERSION`
  - `e4`
  - `e3`
  - `K8S_SERVER_STAGING`
  - `GIT_BINARY`
  - `e2`
  - `TERM_SESSION_ID`
  - `LESS_TERMCAP_ue`
  - `e1`
  - `USER`
  - `NVM_DIR`
  - `COMMAND_MODE`
  - `SSH_AUTH_SOCK`
  - `GIT_REPOS`
  - `__CF_USER_TEXT_ENCODING`
  - `PYENV_VIRTUALENV_INIT`
  - `PAGER`
  - `TMUX`
  - `DRONE_SERVER_PRODUCTION`
  - `git_status_command`
  - `LSCOLORS`
  - `LESS_TERMCAP_us`
  - `PWD`
  - `EDITOR`
  - `LANG`
  - `ITERM_PROFILE`
  - `DRONE_SERVER_STAGING`
  - `XPC_FLAGS`
  - `TMUX_PANE`
  - `GIT_REPO_DIR`
  - `JENKINS_API_TOKEN`
  - `RBENV_SHELL`
  - `git_setup_aliases`
  - `git_env_char`
  - `XPC_SERVICE_NAME`
  - `GPG_TTY`
  - `SHLVL`
  - `PYENV_SHELL`
  - `HOME`
  - `COLORFGBG`
  - `JENKINS_API_USERNAME`
  - `GREP_OPTIONS`
  - `VPN_NAME_STAGING`
  - `ITERM_SESSION_ID`
  - `LOGNAME`
  - `LESS`
  - `VPN_NAME_PRODUCTION`
  - `VISUAL`
  - `LESS_TERMCAP_so`
  - `TMUX_PLUGIN_MANAGER_PATH`
  - `NVM_BIN`
  - `BROWSER`
  - `DRONE_TOKEN_PRODUCTION`
  - `gs_max_changes`
  - `_git_cmd`
  - `is_vim`
  - `SECURITYSESSIONID`
  - `LESS_TERMCAP_se`
  - `COLORTERM`
  - `PYTHONDONTWRITEBYTECODE`
  - `PIP_PYTHON_PATH`
  - `PIPENV_ACTIVE`
  - `WORKON_HOME`
  - `OLDPWD`
  - `VIRTUAL_ENV`
  - `_`

Pipenv–specific environment variables:

 - `PIPENV_VENV_IN_PROJECT`: `true`
 - `PIPENV_ACTIVE`: `1`

Debug–specific environment variables:

  - `PATH`: `/Users/robgolding/src/zapier/tp/.venv/bin:/Users/robgolding/.rbenv/shims:/usr/local/Cellar/pyenv-virtualenv/1.1.1/shims:/Users/robgolding/.pyenv/shims:/Users/robgolding/.cargo/bin:/Users/robgolding/bin:/usr/local/bin:/usr/local/sbin:/usr/local/Cellar/pipenv/2018.5.18/libexec/tools:/Users/robgolding/.rbenv/shims:/usr/local/Cellar/pyenv-virtualenv/1.1.1/shims:/Users/robgolding/.pyenv/shims:/Users/robgolding/.cargo/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/usr/local/opt/nvm/versions/node/v8.9.4/bin:/Users/robgolding/.rvm/bin:/Users/robgolding/.rvm/bin`
  - `SHELL`: `/usr/local/bin/zsh`
  - `EDITOR`: `mvim -v`
  - `LANG`: `en_GB.UTF-8`
  - `PWD`: `/Users/robgolding/src/zapier/tp`
  - `VIRTUAL_ENV`: `/Users/robgolding/src/zapier/tp/.venv`


---------------------------

Contents of `Pipfile` ('/Users/robgolding/src/zapier/tp/Pipfile'):

```toml
[packages]

pyinotify = { git = "https://github.com/daveisfera/pyinotify.git", ref = "3622b05", sys.platform = "== 'linux'" }

```


Contents of `Pipfile.lock` ('/Users/robgolding/src/zapier/tp/Pipfile.lock'):

```json
{
    "_meta": {
        "hash": {
            "sha256": "43438def7ff47b11ae4f1c73aa17e7a4af5a798c5c75b0924a2a35a8b6da0ecf"
        },
        "pipfile-spec": 6,
        "requires": {},
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "pyinotify": {
            "git": "https://github.com/daveisfera/pyinotify.git",
            "ref": "3622b0511037b88be038e34b52b72fbb01e7fa03"
        }
    },
    "develop": {}
}

```
</details>

------------

##### Expected result

The install should succeed (and only install the package on a Linux system, for the above example).

##### Actual result

The install errors out with the above error.

##### Steps to replicate

Using this `Pipfile`:

```
[packages]

pyinotify = { git = "https://github.com/daveisfera/pyinotify.git", sys.platform = "== 'linux'" }
```

Run: `$ pipenv install`


Discussion:
Hi @robgolding thanks for using pipenv and the issue template!  I believe the syntax is incorrect in your pipfile, while in a setup.py, that would be ok, in requirements.txt files and Pipfiles, the syntax is changed from `sys.platform` to `sys_platform`.  

Try the following pipfile:
```
[packages]

pyinotify = { git = "https://github.com/daveisfera/pyinotify.git", markers="sys_platform == 'linux'" }
```
huh perhaps not, hold please, replicating error
<details><summary>$ python -m pipenv.help output</summary>

Pipenv version: `'2018.6.25'`

Pipenv location: `'c:\\users\\erin\\repos\\pipenv\\pipenv'`

Python location: `'C:\\Python36\\python.exe'`

Other Python installations in `PATH`:

  - `3.6`: `C:\Python36\python.exe`

  - `3.6.4`: `C:\Python36\python.exe`
  - `3.6.5`: `C:\Windows\py.exe`

PEP 508 Information:

```
{'implementation_name': 'cpython',
 'implementation_version': '3.6.4',
 'os_name': 'nt',
 'platform_machine': 'AMD64',
 'platform_python_implementation': 'CPython',
 'platform_release': '10',
 'platform_system': 'Windows',
 'platform_version': '10.0.16299',
 'python_full_version': '3.6.4',
 'python_version': '3.6',
 'sys_platform': 'win32'}
```

System environment variables:

  - `ALIASES`
  - `ALLUSERSPROFILE`
  - `ANSICON`
  - `ANSICON_DEF`
  - `APPDATA`
  - `ARCHITECTURE`
  - `CMDER_ROOT`
  - `COMMONPROGRAMFILES`
  - `COMMONPROGRAMFILES(X86)`
  - `COMMONPROGRAMW6432`
  - `COMPUTERNAME`
  - `COMSPEC`
  - `CONEMUANSI`
  - `CONEMUANSILOG`
  - `CONEMUARGS`
  - `CONEMUARGS2`
  - `CONEMUBACKHWND`
  - `CONEMUBASEDIR`
  - `CONEMUBUILD`
  - `CONEMUCONFIG`
  - `CONEMUDIR`
  - `CONEMUDRAWHWND`
  - `CONEMUDRIVE`
  - `CONEMUHOOKS`
  - `CONEMUHWND`
  - `CONEMUPALETTE`
  - `CONEMUPID`
  - `CONEMUSERVERPID`
  - `CONEMUTASK`
  - `CONEMUWORKDIR`
  - `CONEMUWORKDRIVE`
  - `CUDA_PATH`
  - `CUDA_PATH_V8_0`
  - `CUDA_PATH_V9_0`
  - `CUDA_PATH_V9_1`
  - `FSHARPINSTALLDIR`
  - `FWI`
  - `GITHUB_TOKEN`
  - `GIT_INSTALL_ROOT`
  - `GYP_MSVS_VERSION`
  - `HOME`
  - `HOMEDRIVE`
  - `HOMEPATH`
  - `KICAD_PTEMPLATES`
  - `KISYS3DMOD`
  - `KISYSMOD`
  - `LOCALAPPDATA`
  - `LOGONSERVER`
  - `NUMBER_OF_PROCESSORS`
  - `NVCUDASAMPLES8_0_ROOT`
  - `NVCUDASAMPLES9_0_ROOT`
  - `NVCUDASAMPLES9_1_ROOT`
  - `NVCUDASAMPLES_ROOT`
  - `NVTOOLSEXT_PATH`
  - `ONEDRIVE`
  - `OS`
  - `PATH`
  - `PATHEXT`
  - `PLINK_PROTOCOL`
  - `PROCESSOR_ARCHITECTURE`
  - `PROCESSOR_IDENTIFIER`
  - `PROCESSOR_LEVEL`
  - `PROCESSOR_REVISION`
  - `PROGRAMDATA`
  - `PROGRAMFILES`
  - `PROGRAMFILES(X86)`
  - `PROGRAMW6432`
  - `PROMPT`
  - `PSMODULEPATH`
  - `PUBLIC`
  - `PYTHON`
  - `PYTHONIOENCODING`
  - `SESSIONNAME`
  - `SVN_SSH`
  - `SYSTEMDRIVE`
  - `SYSTEMROOT`
  - `TEMP`
  - `TERM`
  - `TMP`
  - `USER-ALIASES`
  - `USERDOMAIN`
  - `USERDOMAIN_ROAMINGPROFILE`
  - `USERNAME`
  - `USERPROFILE`
  - `VERBOSE-OUTPUT`
  - `VS140COMNTOOLS`
  - `WINDIR`
  - `WIX`
  - `PYTHONDONTWRITEBYTECODE`
  - `PIP_PYTHON_PATH`

Pipenv–specific environment variables:


Debug–specific environment variables:

  - `PATH`: `C:\Users\erin\Desktop\cmder\bin;C:\Users\erin\Desktop\cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\Users\erin\Desktop\cmder\vendor\conemu-maximus5;C:\Users\erin\Desktop\cmder\vendor\conemu-maximus5\ConEmu;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\libnvvp;C:\Python36\;C:\Python36\Scripts\;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Gpg4win\..\GnuPG\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\WinSCP\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files (x86)\WiX Toolset v3.11\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\GitExtensions\;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin;C:\Program Files (x86)\Git\cmd;C:\Python36\Scripts\;C:\Python36\;C:\Users\erin\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\FAHClient;C:\Program Files (x86)\Atmel\Flip 3.4.7\bin;C:\Program Files\Microsoft VS Code Insiders\bin;C:\Users\erin\AppData\Local\Yarn\bin;C:\Users\erin\AppData\Roaming\npm;C:\Users\erin\AppData\Local\Programs\Fiddler;C:\Program Files (x86)\Git\usr\bin;C:\Program Files (x86)\Git\usr\share\vim\vim74;C:\Users\erin\Desktop\cmder\`


---------------------------

Contents of `Pipfile` ('C:\\Users\\erin\\repos\\pipenv_test\\Pipfile'):

```toml
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

spotify-local = {editable = true, git = "https://github.com/erinxocon/spotify-local.git"}

[dev-packages]


[requires]
python_version = "3.6"

```


Contents of `Pipfile.lock` ('C:\\Users\\erin\\repos\\pipenv_test\\Pipfile.lock'):

```json
{
    "_meta": {
        "hash": {
            "sha256": "f4c0c04a716a434b6153d1bc0b4112088adc1883da7d4f7e3da756fb64e856f6"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.6"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "certifi": {
            "hashes": [
                "sha256:13e698f54293db9f89122b0581843a782ad0934a4fe0172d2a980ba77fc61bb7",
                "sha256:9fa520c1bacfb634fa7af20a76bcbd3d5fb390481724c597da32c719a7dca4b0"
            ],
            "version": "==2018.4.16"
        },
        "chardet": {
            "hashes": [
                "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
                "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
            ],
            "version": "==3.0.4"
        },
        "idna": {
            "hashes": [
                "sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e",
                "sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16"
            ],
            "version": "==2.7"
        },
        "keyboard": {
            "hashes": [
                "sha256:58912e4be21529fc5b57f89af7f90b0b5f5af4db08c74a8233821700eaabf189",
                "sha256:d4375e4be666a91b71e782fdffa017cbf1a6de98f8c9fe8b66e9386944380c45"
            ],
            "version": "==0.13.2"
        },
        "requests": {
            "hashes": [
                "sha256:63b52e3c866428a224f97cab011de738c36aec0185aa91cfacd418b5d58911d1",
                "sha256:ec22d826a36ed72a7358ff3fe56cbd4ba69dd7a6718ffd450ff0e9df7a47ce6a"
            ],
            "version": "==2.19.1"
        },
        "spotify-local": {
            "editable": true,
            "git": "https://github.com/erinxocon/spotify-local.git",
            "ref": "8188eef221e3d8b9f408ff430d80e74560360459"
        },
        "urllib3": {
            "hashes": [
                "sha256:a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf",
                "sha256:b5725a0bd4ba422ab0e66e89e030c806576753ea3ee08554382c14e685d117b5"
            ],
            "version": "==1.23"
        }
    },
    "develop": {}
}

```
</details>

The following pipfile locks fine:
```toml
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

spotify-local = {editable = true, git = "https://github.com/erinxocon/spotify-local.git"}

[dev-packages]


[requires]
python_version = "3.6"
```

This next pipfile does not lock:
```toml
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

spotify-local = {editable = true, git = "https://github.com/erinxocon/spotify-local.git", markers="sys_platform == 'linux'"}

[dev-packages]


[requires]
python_version = "3.6"
```
and results in the following error:  

```
λ pipenv lock
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
\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 "c:\\users\\erin\\repos\\pipenv\\pipenv\\resolver.py", line 86, in <module>
    main()
  File "c:\\users\\erin\\repos\\pipenv\\pipenv\\resolver.py", line 75, in main
    system=system,
  File "c:\\users\\erin\\repos\\pipenv\\pipenv\\resolver.py", line 62, in resolve
    allow_global=system,
  File "c:\users\erin\repos\pipenv\pipenv\utils.py", line 403, in resolve_deps
    req_dir=req_dir
  File "c:\users\erin\repos\pipenv\pipenv\utils.py", line 285, in actually_resolve_deps
    constraints = [c for c in constraints]
  File "c:\users\erin\repos\pipenv\pipenv\utils.py", line 285, in <listcomp>
    constraints = [c for c in constraints]
  File "c:\users\erin\repos\pipenv\pipenv\patched\notpip\_internal\req\req_file.py", line 89, in parse_requirements
    for req in req_iter:
  File "c:\users\erin\repos\pipenv\pipenv\patched\notpip\_internal\req\req_file.py", line 164, in process_line
    constraint=constraint, isolated=isolated, wheel_cache=wheel_cache
  File "c:\users\erin\repos\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: 'spotify-local;'
```

It seems when there are markers pip can't resolve the package.

Resolving patch:
diff --git a/pipenv/vendor/requirementslib/__init__.py b/pipenv/vendor/requirementslib/__init__.py
--- a/pipenv/vendor/requirementslib/__init__.py
+++ b/pipenv/vendor/requirementslib/__init__.py
@@ -1,5 +1,5 @@
 # -*- coding=utf-8 -*-
-__version__ = "1.0.5.dev0"
+__version__ = "1.0.6"
 
 
 from .exceptions import RequirementError
diff --git a/pipenv/vendor/requirementslib/models/requirements.py b/pipenv/vendor/requirementslib/models/requirements.py
--- a/pipenv/vendor/requirementslib/models/requirements.py
+++ b/pipenv/vendor/requirementslib/models/requirements.py
@@ -649,7 +649,7 @@ def hashes_as_pip(self):
     @property
     def markers_as_pip(self):
         if self.markers:
-            return "; {0}".format(self.markers)
+            return "; {0}".format(self.markers.replace('"', "'"))
 
         return ""
 


Test patch: