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

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
@@ -307,6 +307,21 @@ def _iter_dependencies(self, ireq):
                                                ', '.join(sorted(dependency_strings, key=lambda s: s.lower())) or '-'))
         from pip._vendor.packaging.markers import InvalidMarker
         for dependency_string in dependency_strings:
+            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 = []
+                if len(tokens) == 1:
+                    cleaned_deps.append(tokens[0])
+                    continue
+                markers = list(set(tokens[1:]))
+                cleaned_tokens.append(tokens[0])
+                if markers:
+                    cleaned_tokens.extend(markers)
+                cleaned_deps.append('; '.join(cleaned_tokens))
+            dependency_string = ', '.join(set(cleaned_deps))
             yield InstallRequirement.from_line(dependency_string, constraint=ireq.constraint)
 
 


Test patch: