Na svou otázku odpovídám sám.
Abych našel příčinu problému, vytvořil jsem a otestoval jsem nový virtualenv v rámci instance beanstalk.
Nejprve pip install --upgrade setuptools
, pip install --upgrade pip
funguje správně. Ale po upgradu pip na nejnovější (2020.3.2), pip install --upgrade setuptools
udělat stejný problém. A když jsem downgradoval pip na 2020.3.1 pomocí pip install --upgrade pip==2020.3.1
, problém to vyřešilo!
Takže hlavní příčinou je pip2020.3.2. Zdá se, že pip 2020.3.2 je zatím vydán (https://pypi.org/project/pip/20.3.2/). Nejsem si jistý, proč je nainstalováno vytržené vydání.
Testoval jsem to v Linuxu/2.9.16 (python 3.6), MacOS11.0.1 (python 3.6, 3.9) a dostal jsem stejné výsledky.
Každopádně doufám, že to pomůže ostatním, kteří mají podobné problémy.
Níže je uveden postup odstraňování problémů.
[[email protected] ~]$ python3 -m venv test-env
[[email protected] ~]$ source ./test-env/bin/activate
(test-env) [[email protected] ~]$ pip --version
pip 18.1 from /home/ec2-user/test-env/lib64/python3.6/dist-packages/pip (python 3.6)
(test-env) [[email protected] ~]$ 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) [[email protected] ~]$ 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) [[email protected] ~]$ 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) [[email protected] ~]$ pip --version
pip 20.3.2 from /home/ec2-user/test-env/lib64/python3.6/dist-packages/pip (python 3.6)
(test-env) [[email protected] ~]$ 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) [[email protected] ~]$ pip install --upgrade setuptools
Requirement already satisfied: setuptools in ./test-env/lib/python3.6/dist-packages (51.0.0)
(test-env) [[email protected] ~]$