Skip to content

CommandError: To modify pip, please run the following command #11431

@edp1096

Description

@edp1096

Description

When install pip 22.1 or higher using wheel into python embeddable, error occured.

Is there something I losted?

Expected behavior

Install latest pip to fresh python embeddable

pip version

22.1 or higher

Python version

3.10.6

OS

Windows 11 Pro 21H2 22000.856

How to Reproduce

Create and run below batch files in each empty folder

  • work.cmd - Installing pip 22.0.4
@echo off

set PYTHON_VERSION=3.10.6

set PATH=%cd%\bin;C:\Windows;C:\Windows\System;C:\Windows\System32
set PATH=%cd%\python3;%cd%\python3\Scripts;%PATH%

set PIP_NO_CACHE_DIR=off
@REM set PIP_TARGET=%cd%\pip\cache

curl --progress-bar -Lo python3.zip https://www.python.org/ftp/python/%PYTHON_VERSION%/python-%PYTHON_VERSION%-embed-amd64.zip
if not exist python3 ( mkdir python3 )
tar -xf python3.zip --directory=python3

md python3\Scripts

curl --progress-bar -Lo get-pip.py https://bootstrap.pypa.io/get-pip.py
@REM python get-pip.py


echo import site>> python3\python310._pth
echo .\DLLs>> python3\python310._pth
echo .\lib>> python3\python310._pth
echo .\lib\plat-win>> python3\python310._pth
echo .\lib\site-packages>> python3\python310._pth

@REM del get-pip.py
@REM del python3.zip


@REM Work
set PIP_WHEEL_NAME=pip-22.0.4-py3-none-any.whl
set PIP_WHEEL_URL=https://files.pythonhosted.org/packages/4d/16/0a14ca596f30316efd412a60bdfac02a7259bf8673d4d917dc60b9a21812/%PIP_WHEEL_NAME%
curl --progress-bar -Lo %PIP_WHEEL_NAME% %PIP_WHEEL_URL%
python %PIP_WHEEL_NAME%/pip install --no-index %PIP_WHEEL_NAME%
  • not_work.cmd - Installing pip 22.2.2
@echo off

set PYTHON_VERSION=3.10.6

set PATH=%cd%\bin;C:\Windows;C:\Windows\System;C:\Windows\System32
set PATH=%cd%\python3;%cd%\python3\Scripts;%PATH%

set PIP_NO_CACHE_DIR=off
@REM set PIP_TARGET=%cd%\pip\cache

curl --progress-bar -Lo python3.zip https://www.python.org/ftp/python/%PYTHON_VERSION%/python-%PYTHON_VERSION%-embed-amd64.zip
if not exist python3 ( mkdir python3 )
tar -xf python3.zip --directory=python3

md python3\Scripts

curl --progress-bar -Lo get-pip.py https://bootstrap.pypa.io/get-pip.py
@REM python get-pip.py


echo import site>> python3\python310._pth
echo .\DLLs>> python3\python310._pth
echo .\lib>> python3\python310._pth
echo .\lib\plat-win>> python3\python310._pth
echo .\lib\site-packages>> python3\python310._pth

@REM del get-pip.py
@REM del python3.zip

@REM Not work
set PIP_WHEEL_NAME=pip-22.2.2-py3-none-any.whl
set PIP_WHEEL_URL=https://files.pythonhosted.org/packages/1f/2c/d9626f045e7b49a6225c6b09257861f24da78f4e5f23af2ddbdf852c99b8/%PIP_WHEEL_NAME%
curl --progress-bar -Lo %PIP_WHEEL_NAME% %PIP_WHEEL_URL%
python %PIP_WHEEL_NAME%/pip install --no-index %PIP_WHEEL_NAME%

Output

  • Expected - work 22.0 or before
Microsoft Windows [Version 10.0.22000.856]
(c) Microsoft Corporation. All rights reserved.

D:\devs\pip_work>install_python.cmd
################################################################################################################ 100.0%
################################################################################################################ 100.0%
Processing d:\devs\pip_work\pip-22.0.4-py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-22.0.4

D:\devs\pip_work>
  • Output - not work 22.1 or higher
Microsoft Windows [Version 10.0.22000.856]
(c) Microsoft Corporation. All rights reserved.

D:\devs\pip_notwork>install_python.cmd
################################################################################################################ 100.0%
################################################################################################################ 100.0%
Processing d:\devs\pip_notwork\pip-22.2.2-py3-none-any.whl
┌─────────────────────────────── Traceback (most recent call last) ────────────────────────────────┐
│ D:\devs\pip_notwork\runpy.py:196 in _run_module_as_main                                          │
│                                                                                                  │
│ [Errno 2] No such file or directory: 'D:\\devs\\pip_notwork\\runpy.py'                           │
│                                                                                                  │
│ D:\devs\pip_notwork\runpy.py:86 in _run_code                                                     │
│                                                                                                  │
│ [Errno 2] No such file or directory: 'D:\\devs\\pip_notwork\\runpy.py'                           │
│                                                                                                  │
│ D:\devs\pip_notwork\pip-22.2.2-py3-none-any.whl\pip\__main__.py:31 in <module>                   │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ 'D:\\devs\\pip_notwork\\pip-22.2.2-py3-none-any.whl\\pip\\__main__.py'                           │
│                                                                                                  │
│ D:\devs\pip_notwork\pip-22.2.2-py3-none-any.whl\pip\_internal\cli\main.py:70 in main             │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ 'D:\\devs\\pip_notwork\\pip-22.2.2-py3-none-any.whl\\pip\\_internal\\cli\\main.py'               │
│                                                                                                  │
│ D:\devs\pip_notwork\pip-22.2.2-py3-none-any.whl\pip\_internal\cli\base_command.py:101 in main    │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ 'D:\\devs\\pip_notwork\\pip-22.2.2-py3-none-any.whl\\pip\\_internal\\cli\\base_command.py'       │
│                                                                                                  │
│ D:\devs\pip_notwork\pip-22.2.2-py3-none-any.whl\pip\_internal\cli\base_command.py:221 in _main   │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ 'D:\\devs\\pip_notwork\\pip-22.2.2-py3-none-any.whl\\pip\\_internal\\cli\\base_command.py'       │
│                                                                                                  │
│ D:\devs\pip_notwork\pip-22.2.2-py3-none-any.whl\pip\_internal\cli\req_command.py:247 in wrapper  │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ 'D:\\devs\\pip_notwork\\pip-22.2.2-py3-none-any.whl\\pip\\_internal\\cli\\req_command.py'        │
│                                                                                                  │
│ D:\devs\pip_notwork\pip-22.2.2-py3-none-any.whl\pip\_internal\commands\install.py:407 in run     │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ 'D:\\devs\\pip_notwork\\pip-22.2.2-py3-none-any.whl\\pip\\_internal\\commands\\install.py'       │
│                                                                                                  │
│ D:\devs\pip_notwork\pip-22.2.2-py3-none-any.whl\pip\_internal\utils\misc.py:577 in               │
│ protect_pip_from_modification_on_windows                                                         │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ 'D:\\devs\\pip_notwork\\pip-22.2.2-py3-none-any.whl\\pip\\_internal\\utils\\misc.py'             │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
CommandError: To modify pip, please run the following command:
D:\devs\pip_notwork\python3\python.exe -m pip install --debug --no-index pip-22.2.2-py3-none-any.whl

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions