添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

"InvalidRequirement: Invalid requirement, parse error" error after updating a python package

Ask Question

After updating a package (IPython in my case) using pip install -U ipython running any Python script that uses entry points fails with this error:

Traceback (most recent call last):
  File "/home/adrian/dev/indico/env/bin/indico", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/home/adrian/dev/indico/env/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 94, in __init__
    requirement_string[e.loc:e.loc + 8], requirement_string))
pkg_resources._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'< 2.0'"

Nothing else changed, I did not update any other libraries.

This is caused by an issue in setuptools==20.2.1 which is pulled in by IPython (setuptools>..), so a pip install -U updated it.

Until a fixed version is released or the broken version is pulled from PyPI there is a simple workaround (but note that it will break again if something updates setuptools):

  • pip install -U pip
  • pip uninstall setuptools
  • pip install 'setuptools<20.2'
  • The pip update is needed since older versions of pip will not work without setuptools being installed

    See these IRC logs and BitBucket issue for details:

  • http://chat-logs.dcpython.org/day/pypa/2016-02-25
  • https://bitbucket.org/pypa/setuptools/issues/502/packaging-164-does-not-allow-whitepace
  • Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.