【Python】ERROR: After October 2020 you~の対処方法


この記事はプロモーションを含みます。

pip3コマンドの実行時に発生するエラー「ERROR: After October 2020 you may experience errors~」の対処方法について解説します。

事象とエラーの内容

pip3コマンドで、あるパッケージをインストールした際、下記のエラーが出力されました。

ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.

We recommend you use –use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.

以下は、コマンド実行時のログで、黄文字部分がエラーになります。
ログの最後の方に「Successfully」と出力されているので、インストール自体は成功しているようですが、エラーが気持ち悪いので調べたところ、pipコマンドの依存関係チェックが厳しくなったことが原因のようです。

[root@STKAWX001 ~]# pip3 install requests docker docker-compose
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting requests
  Downloading requests-2.28.1-py3-none-any.whl (62 kB)
     |????????????????????????????????| 62 kB 2.7 MB/s

~~~省略~~~
Using legacy 'setup.py install' for docopt, since package 'wheel' is not installed.
Using legacy 'setup.py install' for dockerpty, since package 'wheel' is not installed.
Installing collected packages: urllib3, certifi, idna, charset-normalizer, requests, packaging, websocket-client, docker, docopt, six, pyrsistent, attrs, jsonschema, PyYAML, dockerpty, distro, python-dotenv, texttable, docker-compose
    Running setup.py install for docopt ... done
    Running setup.py install for dockerpty ... done
ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.

We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.

docker-compose 1.29.2 requires websocket-client<1,>=0.32.0, but you'll have websocket-client 1.4.2 which is incompatible.
Successfully installed PyYAML-5.4.1 attrs-22.1.0 certifi-2022.12.7 charset-normalizer-2.1.1 distro-1.8.0 docker-6.0.1 docker-compose-1.29.2 dockerpty-0.4.1 docopt-0.6.2 idna-3.4 jsonschema-3.2.0 packaging-22.0 pyrsistent-0.19.2 python-dotenv-0.21.0 requests-2.28.1 six-1.16.0 texttable-1.6.7 urllib3-1.26.13 websocket-client-1.4.2

対処方法

対処方法は簡単で、コマンドに「--use-feature=2020-resolver」を付けることでエラーが出力されなくなりました。
実際に実行したコマンドは以下になります。

pip3 install --use-feature=2020-resolver requests docker docker-compose

下記が実際のログになります。
エラーが消えていることが分かります。

[root@STKAWX001 ~]# pip3 install --use-feature=2020-resolver requests docker docker-compose
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting requests
  Downloading requests-2.28.1-py3-none-any.whl (62 kB)
     |????????????????????????????????| 62 kB 1.2 MB/s

~~~省略~~~
Collecting pycparser
  Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
     |????????????????????????????????| 118 kB 33.9 MB/s
Using legacy 'setup.py install' for docopt, since package 'wheel' is not installed.
Using legacy 'setup.py install' for dockerpty, since package 'wheel' is not installed.
Installing collected packages: pycparser, urllib3, six, idna, charset-normalizer, cffi, certifi, websocket-client, requests, pynacl, packaging, cryptography, bcrypt, pyrsistent, paramiko, docker, attrs, texttable, PyYAML, python-dotenv, jsonschema, docopt, dockerpty, distro, docker-compose
    Running setup.py install for docopt ... done
    Running setup.py install for dockerpty ... done
Successfully installed PyYAML-5.4.1 attrs-22.1.0 bcrypt-4.0.1 certifi-2022.12.7 cffi-1.15.1 charset-normalizer-2.1.1 cryptography-38.0.4 distro-1.8.0 docker-6.0.1 docker-compose-1.29.2 dockerpty-0.4.1 docopt-0.6.2 idna-3.4 jsonschema-3.2.0 packaging-22.0 paramiko-2.12.0 pycparser-2.21 pynacl-1.5.0 pyrsistent-0.19.2 python-dotenv-0.21.0 requests-2.28.1 six-1.16.0 texttable-1.6.7 urllib3-1.26.13 websocket-client-0.59.0

コメント

タイトルとURLをコピーしました