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

笑着哭i 提交于 2020-12-26 06:54:30

问题


When I run this command, pip install --upgrade pip, all version of pip is installed (in Linux/2.9.16)

I just want to update pip that I'm using to the latest. How could I resolve this?

Below is what I got from the command

pip install --upgrade pip
Requirement already satisfied: pip in /opt/python/run/venv/lib/python3.6/site-packages (20.3.2)
Collecting pip
  Using cached pip-20.3.2-py2.py3-none-any.whl (1.5 MB)
  Using cached pip-20.3.2.tar.gz (1.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
  Using cached pip-20.3.1-py2.py3-none-any.whl (1.5 MB)
  Using cached pip-20.3.1.tar.gz (1.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
  Using cached pip-20.3-py2.py3-none-any.whl (1.5 MB)
  Using cached pip-20.3.tar.gz (1.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
  Using cached pip-20.2.4-py2.py3-none-any.whl (1.5 MB)
  Using cached pip-20.2.4.tar.gz (1.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
  Downloading pip-20.2.3-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 2.2 MB/s
  Downloading pip-20.2.3.tar.gz (1.5 MB)
     |████████████████████████████████| 1.5 MB 8.6 MB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
  Downloading pip-20.2.2-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 13.0 MB/s
  Downloading pip-20.2.2.tar.gz (1.5 MB)
     |████████████████████████████████| 1.5 MB 17.1 MB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
  Downloading pip-20.2.1-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 18.3 MB/s
  Downloading pip-20.2.1.tar.gz (1.5 MB)
     |████████████████████████████████| 1.5 MB 19.8 MB/s
  ...

--- update ---

I run pip install --upgrade pip in Beanstalk using the commands below in .ebextensions/02_python.config

commands:
  01_install_node:
    command: |
      sudo curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
      sudo yum -y install nodejs
  02_install_yarn:
    test: '[ ! -f /usr/bin/yarn ] && echo "Yarn not found, installing..."'
    command: |
      sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
      sudo yum -y install yarn
  03_upgrade_pip:
    command: /opt/python/run/venv/bin/pip install --upgrade pip setuptools wheel
    ignoreErrors: false

And below is the log from beanstalk eb-activity

[2020-12-15T05:08:40.474Z] INFO  [4175]  - [Application update app-930a-201215_140751@14/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_1_mdd_bean/Command 03_upgrade_pip] : Starting activity...
[2020-12-15T05:16:26.425Z] INFO  [4175]  - [Application update app-930a-201215_140751@14/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_1_mdd_bean/Command 03_upgrade_pip] : Activity execution failed, because: Requirement already satisfied: pip in /opt/python/run/venv/lib/python3.6/site-packages (20.3.2)
  Collecting pip
  Using cached pip-20.3.2-py2.py3-none-any.whl (1.5 MB)
  Using cached pip-20.3.2.tar.gz (1.5 MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing wheel metadata: started
  Preparing wheel metadata: finished with status 'done'
  Using cached pip-20.3.1-py2.py3-none-any.whl (1.5 MB)
  Using cached pip-20.3.1.tar.gz (1.5 MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
---- too long ... ---
  Using cached pip-1.2.tar.gz (94 kB)
  Using cached pip-1.1.tar.gz (95 kB)
  Using cached pip-1.0.2.tar.gz (105 kB)
  Using cached pip-1.0.1.tar.gz (104 kB)
  Using cached pip-1.0.tar.gz (100 kB)
  Using cached pip-0.8.3.tar.gz (107 kB)
  Using cached pip-0.8.2.tar.gz (106 kB)
  Using cached pip-0.8.1.tar.gz (105 kB)
  Using cached pip-0.8.tar.gz (98 kB)
  Using cached pip-0.7.2.tar.gz (68 kB)
  Using cached pip-0.7.1.tar.gz (82 kB)
  Using cached pip-0.7.tar.gz (68 kB)
  Using cached pip-0.6.3.tar.gz (71 kB)
  Using cached pip-0.6.2.tar.gz (70 kB)
  Using cached pip-0.6.1.tar.gz (55 kB)
  Using cached pip-0.6.tar.gz (64 kB)
  Using cached pip-0.5.1.tar.gz (54 kB)
  Using cached pip-0.5.tar.gz (53 kB)
  Using cached pip-0.4.tar.gz (50 kB)
  Using cached pip-0.3.1.tar.gz (48 kB)
  Using cached pip-0.3.tar.gz (47 kB)
  WARNING: Discarding https://files.pythonhosted.org/packages/17/05/f66144ef69b436d07f8eeeb28b7f77137f80de4bf60349ec6f0f9509e801/pip-0.3.tar.gz#sha256=183c72455cb7f8860ac1376f8c4f14d7f545aeab8ee7c22cd4caf79f35a2ed47 (from https://pypi.org/simple/pip/). Requested pip from https://files.pythonhosted.org/packages/17/05/f66144ef69b436d07f8eeeb28b7f77137f80de4bf60349ec6f0f9509e801/pip-0.3.tar.gz#sha256=183c72455cb7f8860ac1376f8c4f14d7f545aeab8ee7c22cd4caf79f35a2ed47 has different version in metadata: '0.3.dev0'
  Using cached pip-0.2.1.tar.gz (39 kB)
  Using cached pip-0.2.tar.gz (38 kB)
  Requirement already satisfied: setuptools in /opt/python/run/venv/lib/python3.6/site-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)
  Using cached setuptools-50.0.2-py3-none-any.whl (784 kB)
  Using cached setuptools-50.0.2.zip (2.2 MB)
  Using cached setuptools-50.0.1-py3-none-any.whl (784 kB)
  Using cached setuptools-50.0.1.zip (2.2 MB)
  Using cached setuptools-50.0.0-py3-none-any.whl (783 kB)
  Using cached setuptools-50.0.0.zip (2.2 MB)
  Using cached setuptools-49.6.0-py3-none-any.whl (803 kB)
  Using cached setuptools-49.6.0.zip (2.2 MB)
  Using cached setuptools-49.5.0-py3-none-any.whl (803 kB)
  Using cached setuptools-49.5.0.zip (2.2 MB)
  Using cached setuptools-49.4.0-py3-none-any.whl (803 kB)
  Using cached setuptools-49.4.0.zip (2.2 MB)
  Using cached setuptools-49.3.2-py3-none-any.whl (790 kB)
  Using cached setuptools-49.3.2.zip (2.2 MB)
  Using cached setuptools-49.3.1-py3-none-any.whl (790 kB)
  Using cached setuptools-49.3.1.zip (2.2 MB)
  Using cached setuptools-49.3.0-py3-none-any.whl (790 kB)
  Using cached setuptools-49.3.0.zip (2.2 MB)
  Using cached setuptools-49.2.1-py3-none-any.whl (789 kB)
  Using cached setuptools-49.2.1.zip (2.2 MB)
  Using cached setuptools-49.2.0-py3-none-any.whl (789 kB)
  Using cached setuptools-49.2.0.zip (2.2 MB)
  Using cached setuptools-49.1.3-py3-none-any.whl (789 kB)
  Using cached setuptools-49.1.3.zip (2.2 MB)
  Using cached setuptools-49.1.2-py3-none-any.whl (789 kB)
  Using cached setuptools-49.1.2.zip (2.2 MB)
  Using cached setuptools-49.1.1-py3-none-any.whl (789 kB)
  Using cached setuptools-49.1.1.zip (2.2 MB)
  Using cached setuptools-49.1.0-py3-none-any.whl (789 kB)
  Using cached setuptools-49.1.0.zip (2.2 MB)
  Using cached setuptools-49.0.1-py3-none-any.whl (789 kB)
  Using cached setuptools-49.0.1.zip (2.2 MB)
... Too long ...
  ----------------------------------------
  WARNING: Discarding https://files.pythonhosted.org/packages/4f/b3/51ef01e9af978f6ddc388754a201a5abb316fb8c84293901c92c52344b57/setuptools-0.9.2.zip#sha256=3713572ca0adb93e52a8aabfe1321f616b196dbd2121bc918b1fe829c312f715 (from https://pypi.org/simple/setuptools/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached setuptools-0.9.2.tar.gz (764 kB)
  ERROR: Command errored out with exit status 1:
  command: /opt/python/run/venv/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5ym3esw7/setuptools_20237e3eec0a4c279498d1832c687656/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5ym3esw7/setuptools_20237e3eec0a4c279498d1832c687656/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-5fwh_uaz
  cwd: /tmp/pip-install-5ym3esw7/setuptools_20237e3eec0a4c279498d1832c687656/
  Complete output (15 lines):
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-5ym3esw7/setuptools_20237e3eec0a4c279498d1832c687656/setuptools/__init__.py", line 2, in <module>
  from setuptools.extension import Extension, Library
  File "/tmp/pip-install-5ym3esw7/setuptools_20237e3eec0a4c279498d1832c687656/setuptools/extension.py", line 5, in <module>
  from setuptools.dist import _get_unpatched
  File "/tmp/pip-install-5ym3esw7/setuptools_20237e3eec0a4c279498d1832c687656/setuptools/dist.py", line 7, in <module>
  from setuptools.command.install import install
  File "/tmp/pip-install-5ym3esw7/setuptools_20237e3eec0a4c279498d1832c687656/setuptools/command/__init__.py", line 8, in <module>
  from setuptools.command import install_scripts
  File "/tmp/pip-install-5ym3esw7/setuptools_20237e3eec0a4c279498d1832c687656/setuptools/command/install_scripts.py", line 3, in <module>
  from pkg_resources import Distribution, PathMetadata, ensure_directory
  File "/tmp/pip-install-5ym3esw7/setuptools_20237e3eec0a4c279498d1832c687656/pkg_resources.py", line 1545, in <module>
  register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
  AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
  ----------------------------------------
  WARNING: Discarding https://files.pythonhosted.org/packages/2c/02/3e1e2e547114b6a659923c9d88fa74adec9aa46d46a48f70cd02b9fb4646/setuptools-0.9.2.tar.gz#sha256=5c35683a5473e803a3e192a55c0d86ac3848e8888940dbebbfc6981aa48aa626 (from https://pypi.org/simple/setuptools/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached setuptools-0.9.1.zip (832 kB)
  ERROR: Command errored out with exit status 1:
  command: /opt/python/run/venv/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5ym3esw7/setuptools_b1f18f92b6014cf09a2c38f0c8f5317c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5ym3esw7/setuptools_b1f18f92b6014cf09a2c38f0c8f5317c/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-p15lass8
  cwd: /tmp/pip-install-5ym3esw7/setuptools_b1f18f92b6014cf09a2c38f0c8f5317c/
  Complete output (15 lines):
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-5ym3esw7/setuptools_b1f18f92b6014cf09a2c38f0c8f5317c/setuptools/__init__.py", line 2, in <module>
  from setuptools.extension import Extension, Library
  File "/tmp/pip-install-5ym3esw7/setuptools_b1f18f92b6014cf09a2c38f0c8f5317c/setuptools/extension.py", line 5, in <module>
  from setuptools.dist import _get_unpatched
  File "/tmp/pip-install-5ym3esw7/setuptools_b1f18f92b6014cf09a2c38f0c8f5317c/setuptools/dist.py", line 7, in <module>
  from setuptools.command.install import install
  File "/tmp/pip-install-5ym3esw7/setuptools_b1f18f92b6014cf09a2c38f0c8f5317c/setuptools/command/__init__.py", line 8, in <module>
  from setuptools.command import install_scripts
  File "/tmp/pip-install-5ym3esw7/setuptools_b1f18f92b6014cf09a2c38f0c8f5317c/setuptools/command/install_scripts.py", line 3, in <module>
  from pkg_resources import Distribution, PathMetadata, ensure_directory
  File "/tmp/pip-install-5ym3esw7/setuptools_b1f18f92b6014cf09a2c38f0c8f5317c/pkg_resources.py", line 1545, in <module>
  register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
  AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
  ----------------------------------------
  WARNING: Discarding https://files.pythonhosted.org/packages/9c/46/83b866faeab163db1c4a9fddf93e7d60e28ce2a97cf2669667551f496294/setuptools-0.9.1.zip#sha256=96beffdca47822f90f8e766edd714f3e1b6ca25ef19ea63105b25c0f8b0a384c (from https://pypi.org/simple/setuptools/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached setuptools-0.9.1.tar.gz (764 kB)
  ERROR: Command errored out with exit status 1:
  command: /opt/python/run/venv/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5ym3esw7/setuptools_5101018cccae4f75bea590debe61f9ef/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5ym3esw7/setuptools_5101018cccae4f75bea590debe61f9ef/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-12bms7x7
  cwd: /tmp/pip-install-5ym3esw7/setuptools_5101018cccae4f75bea590debe61f9ef/
  Complete output (15 lines):
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-5ym3esw7/setuptools_5101018cccae4f75bea590debe61f9ef/setuptools/__init__.py", line 2, in <module>
  from setuptools.extension import Extension, Library
  File "/tmp/pip-install-5ym3esw7/setuptools_5101018cccae4f75bea590debe61f9ef/setuptools/extension.py", line 5, in <module>
  from setuptools.dist import _get_unpatched
  File "/tmp/pip-install-5ym3esw7/setuptools_5101018cccae4f75bea590debe61f9ef/setuptools/dist.py", line 7, in <module>
  from setuptools.command.install import install
  File "/tmp/pip-install-5ym3esw7/setuptools_5101018cccae4f75bea590debe61f9ef/setuptools/command/__init__.py", line 8, in <module>
  from setuptools.command import install_scripts
  File "/tmp/pip-install-5ym3esw7/setuptools_5101018cccae4f75bea590debe61f9ef/setuptools/command/install_scripts.py", line 3, in <module>
  from pkg_resources import Distribution, PathMetadata, ensure_directory
  File "/tmp/pip-install-5ym3esw7/setuptools_5101018cccae4f75bea590debe61f9ef/pkg_resources.py", line 1545, in <module>
  register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
  AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
  ----------------------------------------
  WARNING: Discarding https://files.pythonhosted.org/packages/1a/52/645c11a1c57513a43a557cf752833c19223f365771e30c88637170026ef7/setuptools-0.9.1.tar.gz#sha256=00340736e0dd9aa66aed3f52c015080c7fdd7855c4879a13fa5f18afa65ebbb9 (from https://pypi.org/simple/setuptools/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached setuptools-0.9.zip (824 kB)
  ERROR: Could not install packages due to an EnvironmentError: [Errno 28] No space left on device
  
   (ElasticBeanstalk::ExternalInvocationError)



回答1:


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-... ~]$



回答2:


I had the same problem. They fixed their bug. Just run pip install --user --upgrade 'pip==20.3.3'.



来源:https://stackoverflow.com/questions/65300649/the-command-pip-install-upgrade-pip-install-all-version-of-pip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!