The command, pip install --upgrade pip, install all version of pip

I answer my question myself.

To find the cause of the problem, I created and tested a new virtualenv within the beanstalk instance.

At first, pip install --upgrade setuptools, pip install --upgrade pip works properly. But after upgrading pip to the latest (2020.3.2), pip install --upgrade setuptools make the same problem. And When I downgraded pip to 2020.3.1 using pip install --upgrade pip==2020.3.1, it solved the problem!

So the root cause is pip2020.3.2. It seems that pip 2020.3.2 is yanked release yet (https://pypi.org/project/pip/20.3.2/). I'm not sure why the yanked release is installed.

I tested it in Linux/2.9.16(python 3.6), MacOS11.0.1(python 3.6, 3.9) and got the same results.

Anyway, hope this helps others who are having similar problems.

Below is the troubleshooting process.

[ec2-user@ip-... ~]$ python3 -m venv test-env
[ec2-user@ip-... ~]$ source ./test-env/bin/activate
(test-env) [ec2-user@ip-... ~]$ pip --version
pip 18.1 from /home/ec2-user/test-env/lib64/python3.6/dist-packages/pip (python 3.6)
(test-env) [ec2-user@ip-... ~]$ pip install --upgrade setuptools
Collecting setuptools
  Using cached https://files.pythonhosted.org/packages/3d/f2/1489d3b6c72d68bf79cd0fba6b6c7497df4ebf7d40970e2d7eceb8d0ea9c/setuptools-51.0.0-py3-none-any.whl
Installing collected packages: setuptools
  Found existing installation: setuptools 40.6.2
    Uninstalling setuptools-40.6.2:
      Successfully uninstalled setuptools-40.6.2
Successfully installed setuptools-51.0.0
You are using pip version 18.1, however version 20.3.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(test-env) [ec2-user@ip-... ~]$ pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/3d/0c/01014c0442830eb38d6baef0932fdcb389279ce74295350ecb9fe09e048a/pip-20.3.2-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
Successfully installed pip-20.3.2
(test-env) [ec2-user@ip-... ~]$ pip install --upgrade setuptools
Requirement already satisfied: setuptools in ./test-env/lib/python3.6/dist-packages (51.0.0)
Collecting setuptools
  Using cached setuptools-51.0.0-py3-none-any.whl (785 kB)
  Using cached setuptools-51.0.0.zip (2.1 MB)
  Using cached setuptools-50.3.2-py3-none-any.whl (785 kB)
  Using cached setuptools-50.3.2.zip (2.1 MB)
  Using cached setuptools-50.3.1-py3-none-any.whl (785 kB)
  Using cached setuptools-50.3.1.zip (2.1 MB)
  Using cached setuptools-50.3.0-py3-none-any.whl (785 kB)
  Using cached setuptools-50.3.0.zip (2.2 MB)
  Using cached setuptools-50.2.0-py3-none-any.whl (784 kB)
  Using cached setuptools-50.2.0.zip (2.2 MB)
  Using cached setuptools-50.1.0-py3-none-any.whl (784 kB)
  Using cached setuptools-50.1.0.zip (2.2 MB)
  Using cached setuptools-50.0.3-py3-none-any.whl (784 kB)
  Using cached setuptools-50.0.3.zip (2.2 MB)
^CERROR: Operation cancelled by user
(test-env) [ec2-user@ip-... ~]$ pip --version
pip 20.3.2 from /home/ec2-user/test-env/lib64/python3.6/dist-packages/pip (python 3.6)
(test-env) [ec2-user@ip-... ~]$ pip install --upgrade pip==20.3.1
Collecting pip==20.3.1
  Using cached pip-20.3.1-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.3.2
    Uninstalling pip-20.3.2:
      Successfully uninstalled pip-20.3.2
Successfully installed pip-20.3.1
(test-env) [ec2-user@ip-... ~]$ pip install --upgrade setuptools
Requirement already satisfied: setuptools in ./test-env/lib/python3.6/dist-packages (51.0.0)
(test-env) [ec2-user@ip-... ~]$