83

I have a M1 Mac and I just noticed that when I try to upgrade pip or install any packages I get a series of warnings:

user@mac01 ~ $python3 -m pip install --upgrade pip
WARNING: Value for scheme.platlib does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/lib/python3.9/site-packages
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
WARNING: Value for scheme.purelib does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/lib/python3.9/site-packages
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/include/python3.9/UNKNOWN
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9
WARNING: Value for scheme.scripts does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/bin
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/bin
WARNING: Value for scheme.data does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9
WARNING: Additional context:
user = False
home = None
root = None
prefix = None
Requirement already satisfied: pip in /opt/homebrew/lib/python3.9/site-packages (21.1)
WARNING: Value for scheme.platlib does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/lib/python3.9/site-packages
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
WARNING: Value for scheme.purelib does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/lib/python3.9/site-packages
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/include/python3.9/UNKNOWN
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9
WARNING: Value for scheme.scripts does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/bin
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/bin
WARNING: Value for scheme.data does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9
WARNING: Additional context:
user = False
home = None
root = None
prefix = None
user@mac01 ~ $

Please advise.

4
  • 6
    As far as I can tell from reading the github ticket linked in the message you posted: It's just a warning, there is nothing to worry about, there is nothing you have to do. Most likely the warning message will disappear in a future release of pip. github.com/pypa/pip/issues/9617
    – sinoroc
    Apr 24, 2021 at 17:21
  • 4
    You may wish to consider making this the accepted answer, as it has a detailed explanation from a maintainer of the software.
    – Ryan M
    Apr 29, 2021 at 12:20
  • 1
    As expected the warning message disappeared in the maintenance release 21.1.1. So upgrade pip again to get rid of the message.
    – sinoroc
    Apr 30, 2021 at 20:24
  • trac.macports.org/ticket/63325 Jul 31, 2021 at 15:34

6 Answers 6

164
+500

(A pip maintainer here!)

This warning is not harmful per-se, and doesn't affect any installation logic. You can safely use the current pip, ignoring this warning for now.

For those who want a quick answer to silencing this warning: python -m pip install pip=={some-older-version} -- you can pin to an older version of pip for now. It's unnecessary IMO, but you can pick your poison (some warnings to ignore vs older pip version).


For those who want to understand more: This warning was added because we wanted to surface issues that might take place, when we make a transition in the future.

For historical reasons (uhm... Python 2), pip has used distutils.sysconfig to get information about where to install your Python packages. That module can be functionally replaced by sysconfig that was added to the Python standard library in Python 3.2. However, Python distributors patch it (and not sysconfig) to provide an alternative “default install scheme”.

PEP 632 deprecates distutils, and it is going to be removed from the Python standard library. distutils-based installations is something that the Python packaging community has been trying to deprecate and remove for a while.

We've been working with a lot of distributors to get them to fix their patches, so that installations in the future can transition to using sysconfig as their source of truth. This message is a part of our "get information from users of broken Python installations". As you've probably noticed, Python installations with differently configured distutils.sysconfig and sysconfig are exceedingly more common than we'd expected. :)

Update: Newer versions of pip (>21.1.1) should present these messages much less often. If you're still seeing these messages, please look at the issue that the message contains.

6
  • 1
    Thanks for the explanation. Those warnings will be removed in the future? Apr 25, 2021 at 16:54
  • 5
    "Those warnings will be removed in the future?" -- Yes, hopefully because whoever shipped that Python installation fixes it. Or... when we feel like we've have gotten enough information to map out what these configurations look like, and can draw a line in the sand for what will work in the future and what won't. Hopefully, we'd be able to present a proper error message in cases where things will break during a transition period for the users with an escape hatch that has a specific date for removal.
    – pradyunsg
    Apr 26, 2021 at 7:37
  • 1
    A recommendation, reduce this to info level, inform about the future depreciation and add an option to --silence-depreciation. This already seem to be causing problems and users trying random crap doesn't help (nee other answers to this question).
    – Braiam
    Apr 29, 2021 at 12:30
  • 1
    Well, it being noisy and in your face was intentional. It being something that affects basically everyone was not. Anyway, the plan right now is to just remove this warning since we've gotten enough context for what platforms need to be worked on now. When we'll cut the release depends on when the relevant volunteers have enough free time to do so. :)
    – pradyunsg
    Apr 29, 2021 at 13:15
  • 2
    I do not believe that the logging level of the message was downgraded from warning to debug. I am running pip 21.2.1, which is even newer than 21.1.1 and many such messages are appearing at the warning level.
    – Apreche
    Jul 25, 2021 at 17:09
78

downgrading to an earlier version of pip fixed it for me:

python -m pip install pip==21.0.1

6
  • 3
    The solution didn't work for me. I got the same error message today when I worked on Colab whose pip is version 19.3.1, which is even earlier than version 21.0.1. Still waiting for a solution that is applicable in my case. Apr 24, 2021 at 17:45
  • Downgrading did not help me to solve the problem
    – alper
    Apr 25, 2021 at 13:48
  • 6
    No need to downgrade. Better upgrade to pip 21.1.1 (the newest pip release at the time of this writing). pip 21.1.1 removes the warning message.
    – sinoroc
    Apr 30, 2021 at 20:23
  • I got this problem with pip version 21.2.1, and downgraded to 21.1.1 with problem solved. Jul 31, 2021 at 0:00
  • Upgrading to pip 21.2.4 solves the problem for me.
    – user14098813
    Aug 14, 2021 at 10:46
1

For those who failed to run python -m pip install pip==21.0.1 (for example returned the same error message like ValueError: check_hostname requires server_hostname), you can try to disable the system proxy and retry the command (If you were using some proxy like shadowsocks, v2ray, etc).

1

Have you tried running it from a virtual environment?

python3 -m venv venv
source ./venv/bin/activate
pip install --upgrade pip
3
  • 1
    Why do you think doing this in a virtual environment is different from any of the previous answers here? It helps if you don't have the privileges to upgrade it system-wide, but then you will probably be running in a virtualenv already for other reasons.
    – tripleee
    May 6, 2021 at 12:04
  • 1
    Virtual environments won't have the weird behaviours because most redistributors don't modify behaviours of distutils inside a virtualenv. Their goal is to prevent changes to certain system owned directories when running in the global environment.
    – pradyunsg
    May 8, 2021 at 7:40
  • 1
    So, yes, use a virtualenv is a very valid bit of advice. I completely missed that I should've said this in the communication around this change. 😅
    – pradyunsg
    May 8, 2021 at 7:41
-2

IF you, by any chance made any changes to your anaconda (reinstall, update, remove), then the problem may be from which python your pip is trying to use.

If you take a look at the pip (/usr/local/bin/pip3), the shebang may be pointing to a different python file path.

I had the same problem, and I solved it by changing the python reference in the pip3 file.

-2

Interestingly, pip even complains about itself:

C:\python>python -m pip install --upgrade --force-reinstall pip
Collecting pip
  Using cached pip-21.1-py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 21.1
    Uninstalling pip-21.1:
      Successfully uninstalled pip-21.1
WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: C:\python\Include\UNKNOWN
sysconfig: C:\python\Include
WARNING: Additional context:
user = False
home = None
root = None
prefix = None
Successfully installed pip-21.1

You can suppress pedantic warnings by using pip install foo 2>nul on Windows, or pip install foo 2>/dev/null on Linux. However, be warned: this will also suppress important errors

Not the answer you're looking for? Browse other questions tagged or ask your own question.