Help us understand the problem. What is going on with this article?

ModuleNotFoundError: No module named 'pip.req' が出た時の対処方法

背景

setup.py で下記の記述をしている場合、 pip10 以降ではエラーが発生する。
この時の対象方法を紹介。
※自前ライブラリのように setup.py を修正できる場合に限ります。

from pip._internal.req import parse_requirements

対処方法

try: # for pip >= 10
    from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
    from pip.req import parse_requirements

上記のコードに置き換える。

参考 URL

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away