Brew install python (no pip)

After running brew install python I find pip is not installed. Is this intentional? pip3 is installed.

admin$ pip install --upgrade pip
-bash: pip: command not found

admin$ python -m pip --version
/usr/bin/python: No module named pip

admin$ python3 -m pip --version
pip 20.1.1 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

When a package manager asks to use this command to install Python packages does it make a difference which version of pip is used? (I would rather not have to correct every instance of pip)

python3 -m pip install <packagename>

Should I just add an alias to every user’s .bash_profile?

alias pip=pip3

When check version of pip on the command line I get

admin$ pip -V
-bash: pip: command not found

When checking installed packages using

    admin$ pip3 list -vvv
    Package           Version   Location                                                              Installer
    ----------------- --------- --------------------------------------------------------------------- ---
    
    pip               20.1.1    /usr/local/lib/python3.8/site-packages

This is not pip but it’s been referenced to pip3 inside the “entry_points.txt” file
How to make my command line use the latest version of python without specifying pip3 and python3?

admin$ for i in pip pip3 python python3 ; do type $i ; done
-bash: type: pip: not found
pip3 is /usr/local/bin/pip3
python is hashed (/usr/bin/python)
python3 is /usr/local/bin/python3

my path:

admin$ echo "${PATH//:/$'\n'}"
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/opt/nano/bin
/usr/local/sbin

admin$ pip3 install pip -U

Now I get this:

admin$ for i in pip pip3 python python3 ; do type $i ; done
pip is hashed (/usr/local/bin/pip)
pip3 is hashed (/usr/local/bin/pip3)
python is hashed (/usr/bin/python)
python3 is hashed (/usr/local/bin/python3)

Not sure if "hashed" is the way homebrew wants binaries to be linked?

Or if when updating Python through Homebrew if these hashed links will be destroyed?

brew info python says:

python@3.8: stable 3.8.5 (bottled)
Interpreted, interactive, object-oriented programming language
https://www.python.org/
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/python@3.8.rb
License: Python-2.0
==> Dependencies
Build: pkg-config
Required: gdbm, openssl@1.1, readline, sqlite, xz
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python@3.8/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.8/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

I believe this (and the linked documentation) should answer most of your questions.

thanks I did look through that. No where does it mention pip isn’t installed when running brew install python. In fact it says that pip is installed. It also doesn’t say that “python” will be linked to the system installed version of python and not the version installed by homebrew . It also doesn’t mention what “hashed” is.

It says exactly where to find the executable for pip and what it calls the python binary.

It says where it should be. Yes.
Was it there, no. Thus my question.
I thought I provided ample evidence showing that it was not installed and even stated that.

The evidence you provided centers around /usr/local/bin. That’s not where everyone (including brew info python) has been pointing you to:

$ ls -l /usr/local/opt/python@3.8/libexec/bin
total 0
lrwxr-xr-x 1 aho staff 26 Jul 24 13:26 easy_install -> ../../bin/easy_install-3.8
lrwxr-xr-x 1 aho staff 58 Jul 20 21:26 idle -> ../../Frameworks/Python.framework/Versions/3.8/bin/idle3.8
lrwxr-xr-x 1 aho staff 14 Jul 24 13:26 pip -> ../../bin/pip3
lrwxr-xr-x 1 aho staff 59 Jul 20 21:26 pydoc -> ../../Frameworks/Python.framework/Versions/3.8/bin/pydoc3.8
lrwxr-xr-x 1 aho staff 60 Jul 20 21:26 python -> ../../Frameworks/Python.framework/Versions/3.8/bin/python3.8
lrwxr-xr-x 1 aho staff 67 Jul 20 21:26 python-config -> ../../Frameworks/Python.framework/Versions/3.8/bin/python3.8-config
lrwxr-xr-x 1 aho staff 16 Jul 24 13:26 wheel -> ../../bin/wheel3

And since /usr/local/opt/python always points to the “Homebrew-blessed” Python, you even have a stable path to add to your PATH if needed:

$ ls -l /usr/local/opt/python/libexec/bin
total 0
lrwxr-xr-x  1 aho  staff  26 Jul 24 13:26 easy_install -> ../../bin/easy_install-3.8
lrwxr-xr-x  1 aho  staff  58 Jul 20 21:26 idle -> ../../Frameworks/Python.framework/Versions/3.8/bin/idle3.8
lrwxr-xr-x  1 aho  staff  14 Jul 24 13:26 pip -> ../../bin/pip3
lrwxr-xr-x  1 aho  staff  59 Jul 20 21:26 pydoc -> ../../Frameworks/Python.framework/Versions/3.8/bin/pydoc3.8
lrwxr-xr-x  1 aho  staff  60 Jul 20 21:26 python -> ../../Frameworks/Python.framework/Versions/3.8/bin/python3.8
lrwxr-xr-x  1 aho  staff  67 Jul 20 21:26 python-config -> ../../Frameworks/Python.framework/Versions/3.8/bin/python3.8-config
lrwxr-xr-x  1 aho  staff  16 Jul 24 13:26 wheel -> ../../bin/wheel3

Are things not supposed to be where they are after I force installed pip by using the above command??

There were no symlinks installed. Take a look at the dates of my install. The reason they are different is because pip wasn’t found or aliased to pip3 initially. I installed pip3 again after spending hours trying to figure out why and searching the directories you think I didn’t look in.

I am guessing easy install, pip and wheel are all installed when force installing pip3?

$ ls -l /usr/local/opt/python@3.8/libexec/bin
total 0
lrwxr-xr-x  1 admin  staff  26 Aug 30 15:15 easy_install -> ../../bin/easy_install-3.8
lrwxr-xr-x  1 admin  staff  58 Jul 20 08:26 idle -> ../../Frameworks/Python.framework/Versions/3.8/bin/idle3.8
lrwxr-xr-x  1 admin  staff  14 Aug 30 15:15 pip -> ../../bin/pip3
lrwxr-xr-x  1 admin  staff  59 Jul 20 08:26 pydoc -> ../../Frameworks/Python.framework/Versions/3.8/bin/pydoc3.8
lrwxr-xr-x  1 admin  staff  60 Jul 20 08:26 python -> ../../Frameworks/Python.framework/Versions/3.8/bin/python3.8
lrwxr-xr-x  1 admin  staff  67 Jul 20 08:26 python-config -> ../../Frameworks/Python.framework/Versions/3.8/bin/python3.8-config
lrwxr-xr-x  1 admin  staff  16 Aug 30 15:15 wheel -> ../../bin/wheel3

$ ls -l /usr/local/opt/python/libexec/bin
total 0
lrwxr-xr-x  1 admin  staff  26 Aug 30 15:15 easy_install -> ../../bin/easy_install-3.8
lrwxr-xr-x  1 admin  staff  58 Jul 20 08:26 idle -> ../../Frameworks/Python.framework/Versions/3.8/bin/idle3.8
lrwxr-xr-x  1 admin  staff  14 Aug 30 15:15 pip -> ../../bin/pip3
lrwxr-xr-x  1 admin  staff  59 Jul 20 08:26 pydoc -> ../../Frameworks/Python.framework/Versions/3.8/bin/pydoc3.8
lrwxr-xr-x  1 admin  staff  60 Jul 20 08:26 python -> ../../Frameworks/Python.framework/Versions/3.8/bin/python3.8
lrwxr-xr-x  1 admin  staff  67 Jul 20 08:26 python-config -> ../../Frameworks/Python.framework/Versions/3.8/bin/python3.8-config
lrwxr-xr-x  1 admin  staff  16 Aug 30 15:15 wheel -> ../../bin/wheel3

I am not sure what else to say.

As I said in my second post I had to run:

admin$ pip3 install pip -U

Then pip was installed…

admin$ for i in pip pip3 python python3 ; do type $i ; done
pip is hashed (/usr/local/bin/pip)
pip3 is hashed (/usr/local/bin/pip3)
python is hashed (/usr/bin/python)
python3 is hashed (/usr/local/bin/python3)

Initially,
Why was “python” pointing to my system version and not python3?
Why was “pip” not found?

I did find this which answers one of my questions:

You likely have a long PATH set and, to find an executable, the shell needs to search the path. To avoid that time consuming process every time that you want to run a program, the shell may keep a list of programs that it has already found. That list is called a “hash.” When the shell says that which is hashed, it means that it has already done the PATH search and found which and saved its location in the hash.

$ hash -r

$ for i in pip pip3 python python3 ; do type $i ; done
pip is /usr/local/bin/pip
pip3 is /usr/local/bin/pip3
python is aliased to `python3'
python3 is /usr/local/bin/python3

I added the alias to python3 in my .bash_profile

alias python="python3"

I guess this is the way it’s supposed to be. I installed all of this to run one program and it seems to be working.

It was aliased to pip3, it just wasn’t going to be in your path without adding the libexec directory to your path. When you installed pip using pip3 install pip -U you created a new symlink in /usr/local/bin causing pip to show up in your path. This potentially also updated the existing symlinks when it updated the packages.

Because the system python was in your path (/usr/bin) and the homebrew one wasn’t (/usr/local/opt/python@3.8/libexec/bin)

Because the system binary doesn’t provide a pip, and by default the unversioned pip isn’t in your path but in /usr/local/opt/python@3.8/libexec/bin

There seems to be some confusion when I write pip. I am not referring to pip3 I am referring to the old version. I think the answer was that installing python3.8 using homebrew doesn’t install pip it installs pip3. I am sure there is a way to inspect exactly what brew install python installs?

I used pip3 install pip -U for pip to be installed, but I really didn’t need it since any pip command is supposed to be aliased to pip3? Except this wasn’t happening because I didn’t have my path setup correctly (is that what you are saying?) So, I don’t want to have pip installed because it matches with python2 and not python3 and packages will use pip and not pip3 in their commands?

My question was after using that command did it put pip in the correct place? I had three pip executables in /usr/local/bin/pip - not aliases.

So I force uninstalled python and reinstalled to check my theory. I unlinked and relinked python and this is what I found.

The version of pip in /usr/local/bin/ that I had installed was not overwritten by anything brew install python installed however, pip3 and pip3.8 binaries were replaced with aliases to /usr/local/Cellar/python@3.8/3.8.5/bin/pip3

Here are the contents of /usr/local/Cellar/python@3.8/3.8.5/bin

lrwxr-xr-x  1 admin  staff    52 Jul 20 08:26 2to3 -> ../Frameworks/Python.framework/Versions/3.8/bin/2to3
lrwxr-xr-x  1 admin  staff    56 Jul 20 08:26 2to3-3.8 -> ../Frameworks/Python.framework/Versions/3.8/bin/2to3-3.8
-rwxr-xr-x  1 admin  staff  1011 Sep  1 08:21 easy_install-3.8
lrwxr-xr-x  1 admin  staff    53 Jul 20 08:26 idle3 -> ../Frameworks/Python.framework/Versions/3.8/bin/idle3
lrwxr-xr-x  1 admin  staff    55 Jul 20 08:26 idle3.8 -> ../Frameworks/Python.framework/Versions/3.8/bin/idle3.8
-rwxr-xr-x  1 admin  staff   966 Sep  1 08:21 pip3
-rwxr-xr-x  1 admin  staff   970 Sep  1 08:21 pip3.8
lrwxr-xr-x  1 admin  staff    54 Jul 20 08:26 pydoc3 -> ../Frameworks/Python.framework/Versions/3.8/bin/pydoc3
lrwxr-xr-x  1 admin  staff    56 Jul 20 08:26 pydoc3.8 -> ../Frameworks/Python.framework/Versions/3.8/bin/pydoc3.8
lrwxr-xr-x  1 admin  staff    55 Jul 20 08:26 python3 -> ../Frameworks/Python.framework/Versions/3.8/bin/python3
lrwxr-xr-x  1 admin  staff    62 Jul 20 08:26 python3-config -> ../Frameworks/Python.framework/Versions/3.8/bin/python3-config
lrwxr-xr-x  1 admin  staff    57 Jul 20 08:26 python3.8 -> ../Frameworks/Python.framework/Versions/3.8/bin/python3.8
lrwxr-xr-x  1 admin  staff    64 Jul 20 08:26 python3.8-config -> ../Frameworks/Python.framework/Versions/3.8/bin/python3.8-config
-rwxr-xr-x  1 admin  staff   974 Sep  1 08:21 wheel3

Should I remove the pip executable in /usr/local/bin? since that is the version that will be called when I write pip on the command line? I am guessing I want the correct version of pip to be used which is pip3, when using python3?

Do I have to create an alias somewhere, paths.d, or .bash_profile or .profile or .bashrc?

There is no specific direction in the instructions that says add any of these to my PATH to use the version of python that homebrew installed. Are we supposed to add one of these?

/usr/local/opt/python@3.8/libexec/bin
/usr/local/opt/python/libexec/bin
/usr/local/opt/python

It isn’t needed since a version of pip is already installed and this would overwrite it. If you need the executable to be available as just pip you can add the libexec folder to your path to make that happen. A better solution would be to refer explicitly to pip3, since that’s what the python guidelines suggest.

There is no functional difference between having a pip or pip3 executable. It’s just a naming problem.

Yeah, since it’s not managed by homebrew it’ll probably break on the next homebrew python update anyway.

Unversioned symlinks python, python-config, pip etc. pointing to
python3, python3-config, pip3 etc., respectively, have been installed into
/usr/local/opt/python@3.8/libexec/bin

If you want to expose the executables in a directory as commands you need to add the directory to the path. In this case that would be /usr/local/opt/python@3.8/libexec/bin

Thanks for sticking with me on this. So I removed the pip executable and ran pip list --outdated

$ pip list --outdated
Package     Version Latest Type
----------- ------- ------ -----
dnspython   1.16.0  2.0.0  wheel
pip         20.1.1  20.2.2 wheel
pyee        7.0.2   7.0.3  wheel
pytesseract 0.3.5   0.3.6  sdist
setuptools  49.2.0  50.3.0 wheel
tzlocal     1.5.1   2.1    wheel

According to the Python info on homebrew we are to use the following command to update setuptools and pip.

python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade pip

I ran those commands and it reinstalled the pip executable and removed the aliases for pip3 and pip3.8 in /usr/local/bin and replaced them with executables.

I am now getting an issue when testing my python install.

$ brew test python3
==> Testing python@3.8
==> /usr/local/Cellar/python@3.8/3.8.5/bin/python3.8 -c import sqlite3
==> /usr/local/Cellar/python@3.8/3.8.5/bin/python3.8 -c import tkinter; root = tkinter.Tk()
==> /usr/local/Cellar/python@3.8/3.8.5/bin/python3.8 -c import _gdbm
==> /usr/local/Cellar/python@3.8/3.8.5/bin/python3.8 -c import zlib
==> /usr/local/Cellar/python@3.8/3.8.5/bin/pip3 list --format=columns
Last 15 lines from /Users/admin/Library/Logs/Homebrew/python@3.8/test.05.pip3:
  File "/usr/local/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 21, in <module>
    from pip._vendor import pkg_resources
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3252, in <module>
    def _initialize_master_working_set():
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3235, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 585, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 598, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pip._vendor.pkg_resources.DistributionNotFound: The 'pip==20.1.1' distribution was not found and is required by the application
Error: python@3.8: failed
An exception occurred within a child process:
  BuildError: Failed executing: /usr/local/Cellar/python@3.8/3.8.5/bin/pip3 list --format=columns
/usr/local/Homebrew/Library/Homebrew/formula.rb:2025:in `block in system'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1963:in `open'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1963:in `system'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/python@3.8.rb:344:in `block in <class:PythonAT38>'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1834:in `block (3 levels) in run_test'
/usr/local/Homebrew/Library/Homebrew/utils.rb:492:in `with_env'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1833:in `block (2 levels) in run_test'
/usr/local/Homebrew/Library/Homebrew/formula.rb:893:in `with_logging'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1832:in `block in run_test'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:57:in `block in run'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:57:in `chdir'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:57:in `run'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2074:in `mktemp'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1826:in `run_test'
/usr/local/Homebrew/Library/Homebrew/test.rb:37:in `block in <main>'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/usr/local/Homebrew/Library/Homebrew/test.rb:36:in `<main>'

I thought maybe running $ brew unlink python && brew link python would help.

Unlinking /usr/local/Cellar/python@3.8/3.8.5... 22 symlinks removed
Linking /usr/local/Cellar/python@3.8/3.8.5... 
Error: Could not symlink bin/easy_install-3.8
Target /usr/local/bin/easy_install-3.8
already exists. You may want to remove it:
  rm '/usr/local/bin/easy_install-3.8'

To force the link and overwrite all conflicting files:
  brew link --overwrite python@3.8

To list all files that would be deleted:
  brew link --overwrite --dry-run python@3.8

I didn’t test python before I updated pip and setup tools but I am assuming updating those is what caused this.

so i follow directions and

$  brew link --overwrite python@3.8
Linking /usr/local/Cellar/python@3.8/3.8.5... 25 symlinks created

now the previous executables are replaced with aliases and the executables have been moved inside: /usr/local/Cellar/python@3.8/3.8.5/bin

brew test python3 still gives me the same errors.

Checking version for pip inside /usr/local/bin

$ /usr/local/bin/pip -V
pip 20.2.2 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

That’s weird. It seems all of my Python aliases are messed up after updating pip using the command that Homebrew recommends. Not sure where to go from here.

look at this error when trying to get version of pip3 by path.

$ /usr/local/Cellar/python@3.8/3.8.5/bin/pip3 -V
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 791, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pip._vendor.pkg_resources.VersionConflict: (pip 20.2.2 (/usr/local/lib/python3.8/site-packages), Requirement.parse('pip==20.1.1'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.8/3.8.5/bin/pip3", line 33, in <module>
    sys.exit(load_entry_point('pip==20.1.1', 'console_scripts', 'pip3')())
  File "/usr/local/Cellar/python@3.8/3.8.5/bin/pip3", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
    from pip._internal.cli.progress_bars import BAR_TYPES
  File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/progress_bars.py", line 12, in <module>
    from pip._internal.utils.logging import get_indentation
  File "/usr/local/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 18, in <module>
    from pip._internal.utils.misc import ensure_dir
  File "/usr/local/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 21, in <module>
    from pip._vendor import pkg_resources
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3252, in <module>
    def _initialize_master_working_set():
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3235, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 585, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 598, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pip._vendor.pkg_resources.DistributionNotFound: The 'pip==20.1.1' distribution was not found and is required by the application

So, I brew uninstall --ignore-dependencies python && brew install python again to test my theory and voila…

$ brew test python 
==> Testing python@3.8
==> /usr/local/Cellar/python@3.8/3.8.5/bin/python3.8 -c import sqlite3
==> /usr/local/Cellar/python@3.8/3.8.5/bin/python3.8 -c import tkinter; root = tkinter.Tk()
==> /usr/local/Cellar/python@3.8/3.8.5/bin/python3.8 -c import _gdbm
==> /usr/local/Cellar/python@3.8/3.8.5/bin/python3.8 -c import zlib
==> /usr/local/Cellar/python@3.8/3.8.5/bin/pip3 list --format=columns