Repository: pypa/pipenv

Issue:
Error when executing pipenv install
I'm getting an error when trying to run `pipenv install`

1. Ubuntu Linux
1. Python version: `Python 3.6.4`
1. Pipenv version: 11.1.5

##### Expected result

The dependencies install

##### Actual result
```
adler@masada:~/devel/project$ pipenv install 
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
le "/home/adler/.local/lib/python3.6/site-packages/pipenv/resolver.py", line 19, in resolve
    return pipenv.utils.resolve_deps(packages, which, project=project, pre=pre, sources=sources, clear=clear, verbose=verbose)
  File "/home/adler/.local/lib/python3.6/site-packages/pipenv/../pipenv/utils.py", line 392, in resolve_deps
    resolved_tree, resolver = actually_resolve_reps(deps, index_lookup, markers_lookup, project, sources, verbose, clear, pre)
  File "/home/adler/.local/lib/python3.6/site-packages/pipenv/../pipenv/utils.py", line 325, in actually_resolve_reps
    resolved_tree.update(resolver.resolve(max_rounds=PIPENV_MAX_ROUNDS))
  File "/home/adler/.local/lib/python3.6/site-packages/pipenv/patched/piptools/resolver.py", line 102, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/home/adler/.local/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/adler/.local/lib/python3.6/site-packages/pipenv/patched/piptools/resolver.py", line 310, in _iter_dependencies
    yield InstallRequirement.from_line(dependency_string, constraint=ireq.constraint)
  File "/home/adler/.local/lib/python3.6/site-packages/pipenv/patched/pip/req/req_install.py", line 181, in from_line
    markers = Marker(markers)
  File "/home/adler/.local/lib/python3.6/site-packages/pipenv/patched/pip/_vendor/packaging/markers.py", line 282, in __init__
    raise InvalidMarker(err_str)
pip._vendor.packaging.markers.InvalidMarker: Invalid marker: 'python_version in "3.4, 3.5, 3.6"; python_version in "3.4, 3.5, 3.6"', parse error at '; python'
```


Discussion:
Please provide your `Pipfile`.
If you specified `somepackage; python_version in "3.4, 3.5, 3.6"'` as a marker, that's not a valid marker and will continue to throw this error
Hi.

This is the Pipfile.

```
[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[dev-packages]

ipdb = "*"
pre-commit = "*"
pytest-cov = "*"
pytest-django = "*"
vcrpy = "*"
pgcli = "*"


[packages]

belogging = "*"
django = "*"
dj-database-url = "*"
django-cache-url = "*"
django-extensions = "*"
django-widget-tweaks = "*"
django-model-utils = "*"
prettyconf = "*"
"psycopg2" = "*"
unipath = "*"
requests = "*"
pillow = "*"
python-magic = "*"


[requires]

python_version = "3.6"
```

Thank you.
I am experiencing the same issue. Nothing in my project has changed -- the error is only introduced with pipenv v11.1.4. Reverting to v11.1.3 or earlier solves it for me.
@notdaniel please provide your `Pipfile`. We can't fix the bug if we can't reproduce it :)
@kennethreitz Apologies. Here is mine:

```
[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[dev-packages]

pylint = "*"
honcho = "*"
yapf = "*"
konch = "*"
ptpython = "*"
rdbtools = "*"
python-lzf = "*"
"autopep8" = "*"


[packages]

aiohttp = "*"
cchardet = "*"
aiodns = "*"
click = "*"
logzero = "*"
python-telegram-bot = "*"
redis = "*"
walrus = "*"
blinker = "*"
pendulum = "*"
requests = "*"
pyrsistent = "*"
ccxt = "*"
boltons = "*"
ujson = "*"
prettyprinter = "*"
crayons = "*"
"delegator.py" = "*"
twitter = "*"
pytest = "*"
python-decouple = "*"


[requires]

python_version = "3.6"


[pipenv]

allow_prereleases = true```
Thank you. I'll work on a fix ASAP. It's been a long day, though — so might not be until tomorrow. 
another report: https://github.com/pypa/pipenv/issues/1622
This should be fixed in #1624 -- feel free to try it out and let me know: `pip install -e git+https://github.com/pypa/pipenv.git@bugfix/resolver-markers#egg=pipenv`
@techalchemy I'm facing this issue in pipenv 11.8.0 version. Can you please confirm if its fixed in it?
@kennethreitz im still hitting this issue in `11.8.3` . Anything else I can provide for debugging?

```
[[source]]

verify_ssl = true
url = "https://pypi.python.org/simple"
name = "pypi"


[packages]

django-logging-json = {git = "https://github.com/freedomofpress/django-logging.git", ref = "Remove_Elastic", editable = true}
pshtt-dependency-hell = {git = "https://github.com/nabla-c0d3/sslyze.git", ref = "ef357c2e76b6ba66f23db5fb1f95c7e8a6c13b9d", editable = true}
bleach = "*"
django-allauth = "==0.34.0"
django-allauth-2fa = "*"
django-anymail = {extras = ["mailgun"], version = ">=1.4"}
django-modelcluster = "*"
django-recaptcha = "*"
django-settings-export = "*"
django-webpack-loader = "*"
Django = "==1.11.5"
feedparser = "*"
gunicorn = "*"
lxml = "*"
markdown2 = ">=2.3.5"
pshtt = "==0.3.0"
psycopg2 = "*"
Pygments = "*"
unittest-xml-reporting = "*"
wagtail-django-recaptcha = "*"
wagtail-factories = "*"
wagtail-metadata = "*"
wagtail = "<1.13"
zxcvbn-python = "*"


[dev-packages]

factory_boy = "*"
# https://github.com/kevin1024/vcrpy/issues/342
vcrpy = "==1.11.0"

```
@msheiny see #1791 
thanks @techalchemy !! :heart: 

Resolving patch:
diff --git a/pipenv/patched/piptools/resolver.py b/pipenv/patched/piptools/resolver.py
--- a/pipenv/patched/piptools/resolver.py
+++ b/pipenv/patched/piptools/resolver.py
@@ -310,24 +310,28 @@ def _iter_dependencies(self, ireq):
         for dependency_string in dependency_strings:
 
             try:
-                split_deps = dependency_string.split(';')
-                dependencies, markers = split_deps[0], '; '.join(list(set([marker.strip() for marker in split_deps[1:]])))
-                individual_dependencies = [dep.strip() for dep in dependencies.split(', ')]
+                markers = None
+                if ';' in dependency_string:
+                    # split off markers and remove any duplicates by comparing against deps 
+                    dependencies, markers = dependency_string.rsplit(';', 1)
+                    dependency_string = ';'.join([dep for dep in dependencies.split(';') if dep.strip() != markers.strip()])
+                individual_dependencies = [dep.strip() for dep in dependency_string.split(', ')]
                 cleaned_deps = []
                 for dep in individual_dependencies:
                     tokens = [token.strip() for token in dep.split(';')]
                     cleaned_tokens = []
-                    markers = []
+                    dep_markers = []
                     if len(tokens) == 1:
                         cleaned_deps.append(tokens[0])
                         continue
-                    markers = list(set(tokens[1:]))
+                    dep_markers = list(set(tokens[1:]))
                     cleaned_tokens.append(tokens[0])
-                    if markers:
-                        cleaned_tokens.extend(markers)
+                    if dep_markers:
+                        cleaned_tokens.extend(dep_markers)
                     cleaned_deps.append('; '.join(cleaned_tokens))
                 _dependency_string = ', '.join(set(cleaned_deps))
-                _dependency_string += '; {0}'.format(markers)
+                if markers:
+                    _dependency_string += ';{0}'.format(markers)
 
                 yield InstallRequirement.from_line(_dependency_string, constraint=ireq.constraint)
             except InvalidMarker:


Test patch: