Repository: pypa/setuptools

Issue:
pkg_resources._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'and plat'"
Originally reported by: **Anonymous**

---

../ve/bin/python setup.py --quiet develop
Traceback (most recent call last):
  File "setup.py", line 92, in <module>
    setup(**config)
  File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "build/bdist.linux-x86_64/egg/setuptools/command/develop.py", line 34, in run
  File "build/bdist.linux-x86_64/egg/setuptools/command/develop.py", line 133, in install_for_development
  File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 720, in process_distribution

  File "build/bdist.linux-x86_64/egg/pkg_resources/**init**.py", line 838, in resolve
  File "build/bdist.linux-x86_64/egg/pkg_resources/**init**.py", line 2462, in requires
  File "build/bdist.linux-x86_64/egg/pkg_resources/**init**.py", line 2686, in _dep_map
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2696, in _compute_dependencies
  File "build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging/requirements.py", line 94, in __init__
pkg_resources._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'and plat'"

Version 20.1 works fine, 20.2 breaks.

---
- Bitbucket: https://bitbucket.org/pypa/setuptools/issue/503



Discussion:
_Original comment by_ **agronholm (Bitbucket: [agronholm](http://bitbucket.org/agronholm), GitHub: [agronholm](http://github.com/agronholm))**:

---

Thank you.

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

I've filed an [upstream request](https://github.com/pypa/packaging/issues/70) to restore that functionality.

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

Here's where [futures uses that marker](https://github.com/agronholm/pythonfutures/blob/2.2.0/setup.cfg).

_Original comment by_ **agronholm (Bitbucket: [agronholm](http://bitbucket.org/agronholm), GitHub: [agronholm](http://github.com/agronholm))**:

---

Setuptools broke backwards compatibility in 20.2 by delegating requirements to `packaging`, which in itself is a good thing but `packaging` does not support the obsolete `python_implementation` marker which `futures` 2.2 uses. If this is to be fixed, `packaging` needs to restore backwards compatibility and setuptools must re-vendor the updated `packaging` then.

_Original comment by_ **rodcloutier (Bitbucket: [rodcloutier](http://bitbucket.org/rodcloutier), GitHub: [rodcloutier](http://github.com/rodcloutier))**:

---

See issue #518 for repro steps that are also using an older version of futures 

_Original comment by_ **Kotakon (Bitbucket: [Kotakon](http://bitbucket.org/Kotakon), GitHub: [Kotakon](http://github.com/Kotakon))**:

---

i had this issue due to having old version of futures installed. once i deleted it(2.2.0) and reinstalled latest version(3.0.5) the issue has been resolved

_Original comment by_ **agronholm (Bitbucket: [agronholm](http://bitbucket.org/agronholm), GitHub: [agronholm](http://github.com/agronholm))**:

---

It's not; I'm seeing the same thing with no IPython involved.

_Original comment by_ **miohtama (Bitbucket: [miohtama](http://bitbucket.org/miohtama), GitHub: [miohtama](http://github.com/miohtama))**:

---

(Might be) related IPython issue 

https://github.com/ipython/ipython/issues/9311

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

Issue #518 was marked as a duplicate of this issue.

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

Issue #512 was marked as a duplicate of this issue.

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

Issue #509 was marked as a duplicate of this issue.

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

Duplicate of #502.

_Original comment by_ **bastianb (Bitbucket: [bastianb](http://bitbucket.org/bastianb), GitHub: [bastianb](http://github.com/bastianb))**:

---

+1 got the same with latest setuptools and python2.6

pkg_resources._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'and plat'"


Resolving patch:
diff --git a/pkg_resources/_vendor/packaging/__about__.py b/pkg_resources/_vendor/packaging/__about__.py
--- a/pkg_resources/_vendor/packaging/__about__.py
+++ b/pkg_resources/_vendor/packaging/__about__.py
@@ -12,7 +12,7 @@
 __summary__ = "Core utilities for Python packages"
 __uri__ = "https://github.com/pypa/packaging"
 
-__version__ = "16.5"
+__version__ = "16.6"
 
 __author__ = "Donald Stufft and individual contributors"
 __email__ = "donald@stufft.io"
diff --git a/pkg_resources/_vendor/packaging/markers.py b/pkg_resources/_vendor/packaging/markers.py
--- a/pkg_resources/_vendor/packaging/markers.py
+++ b/pkg_resources/_vendor/packaging/markers.py
@@ -73,9 +73,14 @@ class Value(Node):
     L("python_version") |
     L("sys_platform") |
     L("os_name") |
+    L("os.name") |  # PEP-345
+    L("sys.platform") |  # PEP-345
+    L("platform.version") |  # PEP-345
+    L("platform.machine") |  # PEP-345
+    L("platform.python_implementation") |  # PEP-345
     L("extra")
 )
-VARIABLE.setParseAction(lambda s, l, t: Variable(t[0]))
+VARIABLE.setParseAction(lambda s, l, t: Variable(t[0].replace('.', '_')))
 
 VERSION_CMP = (
     L("===") |


Test patch: