stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: No module named pip

Open wyl2000 opened this issue 2 years ago • 22 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

Any error happening after 'commit hash : XXXX' or 'Installing Torch...' bellow is not related to the launcher please report them on Automatic1111's github instead : ☁ https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/new/choose ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Cancel venv "D:\AI\stable-diffusion-webui\venv\Scripts\Python.exe" Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Commit hash: c0ee1488702d5a6ae35fbf7e0422f9f685394920 Installing torch and torchvision Traceback (most recent call last): File "D:\AI\stable-diffusion-webui\launch.py", line 294, in prepare_environment() File "D:\AI\stable-diffusion-webui\launch.py", line 206, in prepare_environment run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch") File "D:\AI\stable-diffusion-webui\launch.py", line 49, in run raise RuntimeError(message) RuntimeError: Couldn't install torch. Command: "D:\AI\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113 Error code: 1 stdout: stderr: D:\AI\stable-diffusion-webui\venv\Scripts\python.exe: No module named pip

请按任意键继续. . .

Steps to reproduce the problem

C:\Users\Administrator>python -m ensurepip Looking in links: c:\Users\ADMINI~1\AppData\Local\Temp\tmpzpu3l19d ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。 Consider using the --user option or check the permissions.

Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in run_code exec(code, run_globals) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\ensurepip_main.py", line 5, in sys.exit(ensurepip.main()) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\ensurepip_init.py", line 287, in _main return bootstrap( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\ensurepip_init.py", line 203, in _bootstrap return _run_pip([*args, *PACKAGE_NAMES], additional_paths) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\ensurepip_init.py", line 104, in _run_pip return subprocess.run(cmd, check=True).returncode File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['C:\Users\Administrator\AppData\Local\Programs\Python\Python310\python.exe', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = ['C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\tmpzpu3l19d\\setuptools-63.2.0-py3-none-any.whl', 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\tmpzpu3l19d\\pip-22.2.1-py3-none-any.whl'] + sys.path\nsys.argv[1:] = ['install', '--no-cache-dir', '--no-index', '--find-links', 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\tmpzpu3l19d', 'setuptools', 'pip']\nrunpy.run_module("pip", run_name="main", alter_sys=True)\n']' returned non-zero exit status 1.

What should have happened?

i don't know

Commit where the problem happens

win11 X64

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

Settings file found, loading
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 →   Updating Settings File
 ✓   SUCCESS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 i   Launcher Version 1.5.5
 i   Python 3.10 path found : C:\Users\Administrator\AppData\Local\Programs\Python\Python310\python.exe
 i   Git found at C:\Program Files\Git
 i   Git is in PATH
 i   Automatic1111 SD WebUI found at D:\AI\stable-diffusion-webui
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  Opening A1111 WebUI Launcher
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 i   Arguments are now: --xformers --ckpt-dir 'D:\AI\stable-diffusion-webui\models'
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ↓   Updating Webui
fatal: unable to access 'https://github.com/AUTOMATIC1111/stable-diffusion-webui/': Recv failure: Connection was reset
 ✓   SUCCESS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 i   No extension found in the extensions folder
 i   Arguments are now: --xformers --ckpt-dir 'D:\AI\stable-diffusion-webui\models'
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  WEBUI LAUNCHING VIA EMS LAUNCHER, EXIT THIS WINDOW TO STOP THE WEBUI
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 !   Any error happening after 'commit hash : XXXX' or 'Installing Torch...' bellow is not related to the launcher please report them on Automatic1111's github instead :
 ☁   https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/new/choose
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Cancel
venv "D:\AI\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: c0ee1488702d5a6ae35fbf7e0422f9f685394920
Installing torch and torchvision
Traceback (most recent call last):
  File "D:\AI\stable-diffusion-webui\launch.py", line 294, in <module>
    prepare_environment()
  File "D:\AI\stable-diffusion-webui\launch.py", line 206, in prepare_environment
    run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch")
  File "D:\AI\stable-diffusion-webui\launch.py", line 49, in run
    raise RuntimeError(message)
RuntimeError: Couldn't install torch.
Command: "D:\AI\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113
Error code: 1
stdout: <empty>
stderr: D:\AI\stable-diffusion-webui\venv\Scripts\python.exe: No module named pip


请按任意键继续. . .

Additional information, context and logs

Settings file found, loading ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ → Updating Settings File ✓ SUCCESS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ i Launcher Version 1.5.5 i Python 3.10 path found : C:\Users\Administrator\AppData\Local\Programs\Python\Python310\python.exe i Git found at C:\Program Files\Git i Git is in PATH i Automatic1111 SD WebUI found at D:\AI\stable-diffusion-webui ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Opening A1111 WebUI Launcher ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ i Arguments are now: --xformers --ckpt-dir 'D:\AI\stable-diffusion-webui\models' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ↓ Updating Webui fatal: unable to access 'https://github.com/AUTOMATIC1111/stable-diffusion-webui/': Recv failure: Connection was reset ✓ SUCCESS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ i No extension found in the extensions folder i Arguments are now: --xformers --ckpt-dir 'D:\AI\stable-diffusion-webui\models' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ WEBUI LAUNCHING VIA EMS LAUNCHER, EXIT THIS WINDOW TO STOP THE WEBUI ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Any error happening after 'commit hash : XXXX' or 'Installing Torch...' bellow is not related to the launcher please report them on Automatic1111's github instead : ☁ https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/new/choose ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Cancel venv "D:\AI\stable-diffusion-webui\venv\Scripts\Python.exe" Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Commit hash: c0ee1488702d5a6ae35fbf7e0422f9f685394920 Installing torch and torchvision Traceback (most recent call last): File "D:\AI\stable-diffusion-webui\launch.py", line 294, in prepare_environment() File "D:\AI\stable-diffusion-webui\launch.py", line 206, in prepare_environment run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch") File "D:\AI\stable-diffusion-webui\launch.py", line 49, in run raise RuntimeError(message) RuntimeError: Couldn't install torch. Command: "D:\AI\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113 Error code: 1 stdout: stderr: D:\AI\stable-diffusion-webui\venv\Scripts\python.exe: No module named pip

请按任意键继续. . .

wyl2000 avatar Jan 03 '23 14:01 wyl2000

try python3 -m ensurepip

aliencaocao avatar Jan 03 '23 15:01 aliencaocao

In some cases deleting your "venv" directory and running the .bat again will solve the problem as the program builds a new venv

max14354 avatar Jan 11 '23 20:01 max14354

In some cases deleting your "venv" directory and running the .bat again will solve the problem as the program builds a new venv

Wow that just deleted a whole 2GiB of stuff that has to be redownloaded.

LightningStalker avatar Feb 07 '23 22:02 LightningStalker

In some cases deleting your "venv" directory and running the .bat again will solve the problem as the program builds a new venv

Worked for me.

Ucda1212 avatar Feb 09 '23 16:02 Ucda1212

try python3 -m ensurepip

Thanks it works

ks374 avatar Feb 21 '23 14:02 ks374

worked for me as well

robertbkuhn avatar Mar 17 '23 15:03 robertbkuhn

If it's a user from mainland China it's like this, you have to use a VPN for global proxy to finish the installation properly, reinstall with wireguard and it's normal. The very VPN global proxy will disconnect the network connection. Damn GFW

wyl2000 avatar Mar 18 '23 15:03 wyl2000

try python3 -m ensurepip

how does one do that? this means nothing to me

SetriaphTFK avatar Mar 18 '23 21:03 SetriaphTFK

Are you using windows education edition? might be because windows defender messes up with py and under education edition user can't turn it off

notedboi avatar Mar 19 '23 01:03 notedboi

Are you using windows education edition? might be because windows defender messes up with py and under education edition user can't turn it off

No I just didn't realize python3 -m ensurepip just meant "run it through cmd," then it hit me like a baseball bat.

SetriaphTFK avatar Mar 19 '23 01:03 SetriaphTFK

In some cases deleting your "venv" directory and running the .bat again will solve the problem as the program builds a new venv

how can I locate and delete my venv directory?

Kostazs avatar Mar 19 '23 07:03 Kostazs

In some cases deleting your "venv" directory and running the .bat again will solve the problem as the program builds a new venv

It was that easy. I spent a week trying to install SD then i gave up thought it just all nonsense. Then again for photoshop i neede SD so i started trying different ways but still the same problem happened. But then out of couriosity i tried your solution although it seems like unreal and it all worked well then. Thank you so much

Amirhj110 avatar Mar 29 '23 20:03 Amirhj110

Same problem. I downloaded release 1.1.0, created an environment for webui in conda and activated it.

Launching (stable-diffusion-webui) D:\Users\username\anaconda3>"F:\stable-diffusion-webui-1.1.0\webui-user.bat"

All dependencies are installed without errors, the application starts.

On the second run I get an error

exit code: 1
stderr:
D:\Users\username\anaconda3\envs\stable-diffusion-webui\python.exe: No module named pip
Launch unsuccessful. Exiting.

Win11x64

ikeszvpvb9ye avatar May 02 '23 17:05 ikeszvpvb9ye

try python3 -m ensurepip

Didnt work invalid syntax

Hamster333sk avatar Jun 07 '23 08:06 Hamster333sk

Go to stable-diffusion-webui\venv\Scripts folder and open python.exe and use the following code

import ensurepip
ensurepip.bootstrap()

pip is loading so the problem is solved and you can now run webui.bat

sametalkis avatar Jun 07 '23 20:06 sametalkis

When run webui-user.bat from CONDA environment

This solves the problem of initial installation and subsequent launches of the application. pip itself remains broken

change webui-user.bat

set PYTHON=D:\Users\my_username\anaconda3\envs\stable-diffusion-webui\python.exe set GIT= set VENV_DIR=D:\Users\my_username\anaconda3\envs\stable-diffusion-webui set COMMANDLINE_ARGS= call "F:\stable-diffusion-webui-1.3.2\webui.bat"

change webui.bat

:launch %PYTHON% "F:\stable-diffusion-webui-1.3.2\launch.py" %* pause exit /b

:accelerate_launch echo Accelerating %ACCELERATE% launch --num_cpu_threads_per_process=6 "F:\stable-diffusion-webui-1.3.2\launch.py" pause exit /b

CHANGE LINE 12 if %ERRORLEVEL% == 0 goto :start_venv

AND DROP SECTION :check_pip

ikeszvpvb9ye avatar Jun 20 '23 01:06 ikeszvpvb9ye

Delete the venv directory and then restart the webui.bat. Successfully. Error reason: venv目录下缺失相关文件

XiaoWei1075 avatar Oct 01 '23 18:10 XiaoWei1075

Solutions that actually work, not the so-called python3 -m ensurepip and deleting your "venv" directory. thx very much, solved a problem that had been bothering me all night!

Same problem. I downloaded release 1.1.0, created an environment for webui in conda and activated it.

Launching (stable-diffusion-webui) D:\Users\username\anaconda3>"F:\stable-diffusion-webui-1.1.0\webui-user.bat"

All dependencies are installed without errors, the application starts.

On the second run I get an error

exit code: 1
stderr:
D:\Users\username\anaconda3\envs\stable-diffusion-webui\python.exe: No module named pip
Launch unsuccessful. Exiting.

Win11x64

When run webui-user.bat from CONDA environment

This solves the problem of initial installation and subsequent launches of the application. pip itself remains broken

change webui-user.bat

set PYTHON=D:\Users\my_username\anaconda3\envs\stable-diffusion-webui\python.exe set GIT= set VENV_DIR=D:\Users\my_username\anaconda3\envs\stable-diffusion-webui set COMMANDLINE_ARGS= call "F:\stable-diffusion-webui-1.3.2\webui.bat"

change webui.bat

:launch %PYTHON% "F:\stable-diffusion-webui-1.3.2\launch.py" %* pause exit /b

:accelerate_launch echo Accelerating %ACCELERATE% launch --num_cpu_threads_per_process=6 "F:\stable-diffusion-webui-1.3.2\launch.py" pause exit /b

CHANGE LINE 12 if %ERRORLEVEL% == 0 goto :start_venv

AND DROP SECTION :check_pip

leantli avatar Dec 15 '23 18:12 leantli

Is there any progress towards creating an adequately launchable installer and running the application on the conda environment? No dancing with tambourines

ikeszvpvb9ye avatar Dec 23 '23 16:12 ikeszvpvb9ye

answering the question 'Why:' ummm, this is my business requirement, it’s more convenient for me

I don’t plan to tear up a virtual machine or even a container for this buggy “product”, nor do I plan to litter my personal host with a carload of Python packages I don’t need

I have a conda build based on the current pyTorch for my hardware, which I deploy via Ctrl+C Ctrl+V, I didn’t like it - I deleted it, Ctrl+V again

ikeszvpvb9ye avatar Dec 23 '23 17:12 ikeszvpvb9ye

In my condition, I changed webui-user.sh, added: export TORCH_COMMAND="pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118" In venv python, pip isnt linked to pip3, so I changed pip3 into pip, solved it.

NULL-Response avatar Jan 06 '24 11:01 NULL-Response

how do I delete the venv? Where is it? Where do I type what?

KatarinaMilkers avatar May 20 '24 18:05 KatarinaMilkers